cancel
Showing results for 
Search instead for 
Did you mean: 

Dashlet file upload

legendre
Champ in-the-making
Champ in-the-making
Hi all,

I have created a dashlet jsp page where I need to submit a binary file with tomahawk JSF extention.
I added bean in faces-config-bean.xml and did not change web.xml

All textfields are catched by the bean except the binary file !

Any ideas?

Thanks for your help

JSP code :

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="x"%>

   <h:inputText id="title" value="#{MyBean.title}" />
   
   <h:inputText id="description" value="#{MyBean.description}" />
   
   <x:inputFileUpload id="file" value="#{MyBean.file}" storage="file"/>
       
   <h:commandButton actionListener="#{MyBean.submit}" action="submit" value="submit" />


Bean code :


import org.apache.myfaces.custom.fileupload.UploadedFile;

public class MyBean {

   private String title;
   private String description;
   private UploadedFile file;   

   public void submit(javax.faces.event.ActionEvent e)
   {
      // todo
   }
   
   public UploadedFile getFile() {
      return file;
   }
   
   public void setFile(UploadedFile file) {
      this.file = file;
   }
   
   public String getTitle() {
      return title;
   }
   
   public void setTitle(String title) {
      this.title = title;
   }
   
   public String getDescription() {
      return description;
   }
   
   public void setDescription(String description) {
      this.description = description;
   }
   
}
1 REPLY 1

gavinc
Champ in-the-making
Champ in-the-making
I believe there are a few other steps required to get the tomahawk upload component working. I know that you need to setup a servlet filter (this is what is used to capture the file contents) so I'd suggest taking a look at the MyFaces documentation for the exact requirements.