3 Replies Latest reply on Mar 11, 2013 12:41 PM by gimbal2

    <t:inputFileUpload> Null File problem

    996038
      Hi all;
      i am developing a JSF portlet project (JSF 2.0 and Portal 7), I am trying to use the <t:inputFileUpload> tag but it always gives me a null Value for the uploaded file, can any onne help me with this?

      the web.xml file contains the required filter mapping
           <filter>
           <filter-name>Extensions Filter</filter-name>
           <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
           </filter>
           <filter-mapping>
           <filter-name>Extensions Filter</filter-name>
           <servlet-name>Faces Servlet</servlet-name>
           </filter-mapping>
      and the jsp code is as follows:

      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
      <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
      <f:view>
      <h:form enctype="multipart/form-data">
           <h:selectOneMenu>
                <f:selectItems id="testLookup"     value="#{LookupsManagedBean.faqCategories}" />
           </h:selectOneMenu>
      <h:commandButton action="#{AuthoringContentBean.testDB}"></h:commandButton>
           <t:inputFileUpload value="#{AuthoringContentBean.uploadedFile}" />
           <h:commandButton styleClass="ShortButton" type="submit" value="add" action="#{AuthoringContentBean.uploadContentFile}"></h:commandButton>
      </h:form>

      </f:view>
        • 1. Re: <t:inputFileUpload> Null File problem
          gimbal2
          Did you try to google for "t:inputFileUpload null"? You are not the first one to run into this. Apparently there are plenty of ways to make the component fail to deliver. You should exhaust your options first before asking here - this is not a MyFaces forum (and tomahawk is part of MyFaces). You may just want to try to ask in the MyFaces mailing lists.

          In the future you should make your information more complete. Are you using Mojarra or MyFaces? Which version of Tomahawk? Also, please use \
           tags when posting code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
          • 2. Re: <t:inputFileUpload> Null File problem
            996038
            First of all, thanks for your reply
            I really did my best trying to solve this before posting my question, all of what i found did not solve my problem, they all said that the problem is either related to the "enctype" of the form or to missing extensionFilter mapping in web.xml. but both cases are correct with me i did declare the filter and specified the enctype.
            I am working with MyFaces, the follwoing are the JARS i am using
            myfaces-api-2.0.14.jar
            myfaces-bundle-2.0.14.jar
            myfaces-impl-2.0.14.jar
            jsf20-portletbridge.jar
            tomahawk-1.1.6.jar
            commons-logging-1.1.1.jar
            commons-io-1.4.jar
            commons-fileupload-1.2.jar
            commons-el.jar
            • 3. Re: <t:inputFileUpload> Null File problem
              gimbal2
              Yeah, so wrong forum. Like I said: try the Apache myfaces mailing lists.

              http://myfaces.apache.org/tomahawk-project/tomahawk20/mail-lists.html

              Now if you have generic JSF API questions, feel free to ask them. But for help with specific APIs, implementations and frameworks not related to Oracle, always look for a forum or mailing list that deals with that product. Or try Stackoverflow which is a more general purpose site that is actually designed to manage such a chaotic "ask anything you want" environment. Its not that you're doing anything illegal by posting here, its simply in your own best interest to maximize the chance of getting an actual answer.