日期:2014-05-18  浏览次数:20675 次

JSF 上传文件的问题
JSP页面:

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
    <head>
        <%@   taglib   uri= "http://java.sun.com/jsf/html "   prefix= "h "%>
        <%@   taglib   uri= "http://java.sun.com/jsf/core "   prefix= "f "%>
        <%@   taglib   uri= "http://java.sun.com/jstl/core "   prefix= "c "%>
        <%@   taglib   uri= "http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld "   prefix= "x "%>
    </head>
    <body   bottommargin= "0 "   topmargin= "0 "   leftmargin= "0 "   rightmargin= "0 ">
        <f:view>
            <h:form   id= "mainForm "   enctype= "multipart/form-data "   style= "margin-top:0em;   margin-bottom:0em ">
                标题:
                <h:inputText   value= "#{XXX.title} "   size= "30 "   maxlength= "30 "> </h:inputText>
                上传文件:
                <x:inputFileUpload   id= "fileupload "   accept= "image/* "   storage= "file "   value= "#{XXX.uploadFile} "   styleClass= "input_large "   required= "false "   />
            </h:form>
        </f:view>
    </body>
</html>

web.xml配置文件:
<filter>
    <filter-name> multipartFilter </filter-name>
    <filter-class> net.sourceforge.myfaces.custom.fileupload.MultipartFilter </filter-class>
        <init-param>
            <param-name> maxFileSize </param-name>
            <param-value> 30m </param-value>
            <description> Set   the   size   limit   for   uploaded   files.
                                Format:   10   -   10   bytes
                                                10k   -   10   KB
                                                10m   -   10   MB
            </description>
        </init-param>
</filter>
<filter-mapping>
    <filter-name> multipartFilter </filter-name>
    <url-pattern> *.jsf </url-pattern>
</filter-mapping>

我现有两个问题:
1、