I am trying to write application to upload images from client machine  to my
web server.  My appln is a jboss portal  application. As soon as i give
enctype the navigation does not work.  If i remove the line, navigation
works but i get NullPointerException accessing myFile. Any help would be
appreciated.

JSP
<h:form id="editPracticePictures" enctype="multipart/form-data"> 
        <h:outputText value="Practice Image Upload: " />
        <h:messages style="color:red"/>
        <t:panelGrid columns="1"> 
            <t:inputFileUpload id="myFile" accept="image/*"
value="#{UploadFileJSFBean.myFile}"  
               size="50" storage="file"/>           <h:commandButton id="upload"
action="#{UploadFileJSFBean.uploadFile}" value="Click here to Upload"
styleClass="submit"/> 
                <h:commandButton id="cancel" action="cancel" value="Cancel"
styleClass="submit"/>
        </t:panelGrid> 

UploadFileJSFBean.java
public final class UploadFileJSFBean extends BaseBean{
private UploadedFile myFile;
public UploadedFile getMyFile() {
                return myFile;
}
public void setMyFile(UploadedFile myFile) {
                this.myFile = myFile;
}
}

web.xml
 <filter>
      <filter-name>MyFacesExtensionsFilter</filter-name>
     
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
      <init-param> 
              <param-name>maxFileSize</param-name> 
              <param-value>20m</param-value> 
      </init-param>      
    </filter>
    <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>


faces-config.xml
<managed-bean>
<managed-bean-name>UploadFileJSFBean</managed-bean-name>
<managed-bean-class>com.healthmarkets.practice.UploadFileJSFBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<navigation-rule>
        <from-view-id>/practice/Pictures.jsp</from-view-id>
        <navigation-case>
            <from-outcome>submit</from-outcome>
            <to-view-id>/practice/PracticeInfo.jsp</to-view-id>
        </navigation-case>
</navigation-rule>

-- 
View this message in context: 
http://www.nabble.com/InputFileUpload-help-needed-tp15433654p15433654.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to