3 Replies Latest reply on Apr 4, 2007 6:05 AM by Ilya Shaikovsky

    Problem with FileUpload

    Nishant Katoch Newbie

      Hello,

      I am facing problem with FileUpload componet of JSF.


      CODE:
      ***************************************************
      <h:form id="myForm" enctype="multipart/form-data">

      <t:inputFileUpload id="fileuploadfield"
      value="#{uploadBean._myFile}"
      storage="memory"
      required="true"/>
      <t:commandButton id="uploadajbut" value="upload" action="#{uploadBean.startUploadNow}" />

      </h:form>
      ***************************************************

      The above code works fine but if If put the above code in a Ajax form I am getting exception. My need is to have the file upload componet in an ajax form, but it doesn't works for me.

      EXCEPTION I GET IS:

      2007-04-03 22:49:04 StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error calling action method of component with id formMyDetails:EditingForm:myForm:uploadajbut
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
      at org.ajax4jsf.framework.ajax.AjaxActionComponent.broadcast(AjaxActionComponent.java:88)
      at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
      at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
      at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)


      ...

      Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
      at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      ... 39 more
      Caused by: java.lang.NullPointerException
      at com.rdi.web.handler.UploadBean.startUploadNow(UploadBean.java:73)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)



      PLEASE HELP.