关于s:fileupload的问题

在使用s:fileupload时,提取文件总显示为空,长度为零,其他诸如filename,contenttype等也为Null.这个问题怎么办?谁知道什么原因?
我的用的jboss+seam:
web.xml:
   <context-param>
       <param-name>com.icesoft.faces.uploadDirectory</param-name>
       <param-value>upload</param-value>
   </context-param>
   <context-param>
       <param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
       <param-value>1001048576</param-value>
   </context-param>


    <servlet>
         <servlet-name>uploadServlet</servlet-name>
         <servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
         <load-on-startup> 1 </load-on-startup>
    </servlet>

component.xml:
         <web:multipart-filter create-temp-files="false" 
	                     max-request-size="10485760" 
	                     url-pattern="/*"/>	


backingbean:
@Stateless
@Name("filebean")
public class FileBean implements FileBeanInterface {
	
        @Logger
	private Log log;
	
	@PersistenceContext
	private EntityManager em;

        private FileData filedata=new FileData();
        private String msginfo="";
	//@In(value="#{facesContext}")
	FacesContext facesContext=FacesContext.getCurrentInstance();
        private ExternalContext extCtx=facesContext.getExternalContext();

        private List<FileData> filelist=new ArrayList();
	
	private Long attachmentId;

        public Long getAttachmentid(){
            return attachmentId;
        }
        public void setAttachmentid(Long attachmentid){
            this.attachmentId=attachmentid;
        }
	public String setFiledata(FileData file){
            this.filedata=file;
            return null;
        }
        public FileData getFiledata(){
            return this.filedata;
        }
        public String getMsginfo(){
            msginfo=filedata.getContentType();
            return msginfo;
        }


        public String download(Long id){
            setAttachmentid(id);
            return download();
        }
	public String download() {
		FileData attachment = em.find(FileData.class, attachmentId);
		HttpServletResponse response = (HttpServletResponse)extCtx.getResponse();
		response.setContentType(attachment.getContentType());
                response.addHeader("Content-disposition", "attachment; filename=\"" + attachment.getName() +"\"");
		try {
			ServletOutputStream os = response.getOutputStream();
			os.write(attachment.getData());
			os.flush();
			os.close();
			facesContext.responseComplete();
		} catch(Exception e) {
			log.error("\nFailure : " + e.toString() + "\n");
		}

		return null;
	}

        public String saveFile(){
            try{
            em.persist(filedata);
            filedata=new FileData();
            }catch(Exception ex){

            }

            return null;
        }

        public String deleteFile(){
            FileData to_delete=em.find(FileData.class,attachmentId);
            em.remove(to_delete);
            em.flush();
            getFilelist();
            return null;
        }

        public String deleteFile(Long id){
            setAttachmentid(id);
            return deleteFile();
        }

        public List<FileData> getFilelist(){
            filelist=em.createQuery("select f from FileData f").getResultList();
            return filelist;
        }
        public void setFilelist(List<FileData> filelist){
            this.filelist=filelist;
        }
        


xhtml
        <h:form enctype="multipart/form-data" >
            <s:fileUpload id="fileupload" accept="text/html"
                          data="#{filebean.filedata.data}"
			  contentType="#{filebean.filedata.contentType}"
                          fileName="#{filebean.filedata.name}"
                          fileSize="#{filebean.filedata.size}"/>
            <br/><br/>
            文件名称:<h:outputText value="#{filebean.filedata.name}"/>
            <br/><br/>
            内容类型:<h:outputText value="#{filebean.filedata.contentType}"/>
            <br/><br/>
            文件长度:<h:outputText value="#{filebean.filedata.size}"/>
            <br/><br/>
            <ice:commandButton value="Upload" partialSubmit="true"
		 action="#{filebean.saveFile}"/>
</h:form>


谁能给看一下怎么回事?

你可能感兴趣的:(xml,jboss,XHTML,OS,seam)