inputFileUpload error

Discussion in 'Java' started by canodabasioglu@gmail.com, Dec 10, 2006.

  1. Guest

    I created FileUploadForm.java as a managed bean in my application which
    I call
    from my upload form copied from UploadForm.jsp - when I click the
    'upload' button I get this error:

    java.lang.NullPointerException at
    com.odabasioglu.master.backbean.FileUploadForm.processMyFile

    UploadForm.jsp******************
    <h:form id="MyForm" enctype="multipart/form-data">
    <x:inputFileUpload id="fileUpload" value="#{FileUploadForm.myFile}"
    storage="file" required="true"/>
    <h:commandButton value="Submit"
    action="#{FileUploadForm.processMyFile}"/>
    </h:form>

    FileUploadForm.java***************
    private UploadedFile myFile;
    private String myParam;
    private String myResult;

    public UploadedFile getMyFile() {
    return myFile;
    }

    public void setMyFile(UploadedFile myFile) {
    this.myFile = myFile;
    }
    public String processMyFile() {

    InputStream in = new
    BufferedInputStream(file.getInputStream());
    }
    web.xml****************
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>
    org.apache.myfaces.component.html.util.ExtensionsFilter
    </filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>10m</param-value>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>100k</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>FacesServlet</servlet-name>
    </filter-mapping>
    , Dec 10, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    2
    Views:
    21,642
  2. JavaQueries
    Replies:
    1
    Views:
    3,632
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,077
  4. Bishop
    Replies:
    1
    Views:
    764
    Bishop
    Feb 24, 2007
  5. Replies:
    1
    Views:
    591
Loading...

Share This Page