You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by António Rodrigues <an...@gmail.com> on 2010/03/02 14:28:47 UTC

Re: file upload using spring web flow

I am not familiar with Trinidad and I might be saying something stupid.
But I can see the inputFile does not have a value property mapped to your
bean.

AJCR


On 27 February 2010 17:34, jnl1 <it...@yahoo.com> wrote:

>
> hi all...
>
>   I'm using spring web flow 2.0.8, trinidad 1.0.2.  The problem I'm having
> is my file upload is not working.  The page is rendering fine.   I select a
> file from the dialog, but the UploadedFile is never set in my backing bean.
> Page navigation is working fine as well.  The only thing that's an issue is
> the file not being set.
>
> Here's my xhtml:
>
>        <tr:form usesUpload="true">
>                                <fieldset>
>                                        <div class="field">
>
>                                        <tr:inputFile label="Upload:"
>                                             id="myFileId"
>                                             type="file"
>
> valueChangeListener="#{searchCriteria.fileUploaded}"/>
>
>                                        </div>
>
>                                        <div class="buttonGroup">
>                                             <h:commandButton
> id="uploadFile" ajaxDisabled="true"
> value="Process File" action="uploadFile" />
>                                        </div>
>
>
> here's my web.xml
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>        version="2.4">
>
>        <!-- The master configuration file for this Spring web application
> -->
>        <context-param>
>                <param-name>contextConfigLocation</param-name>
>                <param-value>
>                        /WEB-INF/config/web-application-config.xml
>                </param-value>
>        </context-param>
>
>        <context-param>
>                <param-name>
>                        org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
>                </param-name>
>                <param-value>true</param-value>
>        </context-param>
>
>        <!-- Use JSF view templates saved as *.xhtml, for use with Facelets
> -->
>        <context-param>
>                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>                <param-value>.xhtml</param-value>
>        </context-param>
>
>        <context-param>
>                <param-name>facelets.LIBRARIES</param-name>
>                <param-value>
>                        /WEB-INF/config/spring-security.taglib.xml
>                </param-value>
>        </context-param>
>
>        <!-- Enables special Facelets debug output during development -->
>        <context-param>
>                <param-name>facelets.DEVELOPMENT</param-name>
>                <param-value>true</param-value>
>        </context-param>
>
>        <!-- Causes Facelets to refresh templates during development -->
>        <context-param>
>                <param-name>facelets.REFRESH_PERIOD</param-name>
>                <param-value>1</param-value>
>        </context-param>
>
>        <!-- Enforce UTF-8 Character Encoding -->
>        <filter>
>                <filter-name>charEncodingFilter</filter-name>
>                <filter-class>
>
>  org.springframework.web.filter.CharacterEncodingFilter
>                </filter-class>
>                <init-param>
>                        <param-name>encoding</param-name>
>                        <param-value>UTF-8</param-value>
>                </init-param>
>                <init-param>
>                        <param-name>forceEncoding</param-name>
>                        <param-value>true</param-value>
>                </init-param>
>        </filter>
>
>        <filter-mapping>
>                <filter-name>charEncodingFilter</filter-name>
>                <url-pattern>/*</url-pattern>
>        </filter-mapping>
>
>        <!-- Enables Spring Security -->
>        <filter>
>                <filter-name>springSecurityFilterChain</filter-name>
>                <filter-class>
>                        org.springframework.web.filter.DelegatingFilterProxy
>                </filter-class>
>        </filter>
>
>        <filter-mapping>
>                <filter-name>springSecurityFilterChain</filter-name>
>                <url-pattern>/*</url-pattern>
>        </filter-mapping>
>
>        <context-param>
>                <param-name>
>                        org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER
>                </param-name>
>
>  <param-value>com.sun.facelets.FaceletViewHandler</param-value>
>        </context-param>
>        <context-param>
>                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>                <param-value>server</param-value>
>        </context-param>
>        <context-param>
>                <param-name>
>                        org.apache.myfaces.trinidad.CHANGE_PERSISTENCE
>                </param-name>
>                <param-value>session</param-value>
>        </context-param>
>        <context-param>
>                <param-name>
>                        org.apache.myfaces.trinidad.ENABLE_QUIRKS_MODE
>                </param-name>
>                <param-value>false</param-value>
>        </context-param>
>        <filter>
>                <filter-name>Trinidad Filter</filter-name>
>                <filter-class>
>                        org.apache.myfaces.trinidad.webapp.TrinidadFilter
>                </filter-class>
>        </filter>
>        <filter-mapping>
>                <filter-name>Trinidad Filter</filter-name>
>                 <servlet-name>Faces Servlet</servlet-name>
>         </filter-mapping>
>
>
>        <filter>
>                <filter-name>MyFacesExtensionsFilter</filter-name>
>
>
> <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
>                <init-param>
>                        <param-name>uploadMaxFileSize</param-name>
>                        <param-value>20m</param-value>
>                </init-param>
>        </filter>
>
>        <filter-mapping>
>                <filter-name>MyFacesExtensionsFilter</filter-name>
>                <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
>        </filter-mapping>
>
>        <filter-mapping>
>                <filter-name>MyFacesExtensionsFilter</filter-name>
>                <url-pattern>*.xhtml</url-pattern>
>        </filter-mapping>
>
>
>        <servlet>
>                <servlet-name>Trinidad Resource Servlet</servlet-name>
>                <servlet-class>
>                        org.apache.myfaces.trinidad.webapp.ResourceServlet
>                </servlet-class>
>        </servlet>
>        <servlet-mapping>
>                <servlet-name>Trinidad Resource Servlet</servlet-name>
>                <url-pattern>/adf/*</url-pattern>
>        </servlet-mapping>
>
>        <!-- Loads the Spring web application context -->
>        <listener>
>                <listener-class>
>
>  org.springframework.web.context.ContextLoaderListener
>                </listener-class>
>        </listener>
>
>        <!-- Serves static resource content from .jar files such as
> spring-faces.jar -->
>        <servlet>
>                <servlet-name>Resources Servlet</servlet-name>
>                <servlet-class>
>                        org.springframework.js.resource.ResourceServlet
>                </servlet-class>
>                <load-on-startup>0</load-on-startup>
>        </servlet>
>
>        <!-- Map all /resources requests to the Resource Servlet for
> handling -->
>        <servlet-mapping>
>                <servlet-name>Resources Servlet</servlet-name>
>                <url-pattern>/resources/*</url-pattern>
>        </servlet-mapping>
>
>        <!-- The front controller of this Spring Web application,
> responsible for
> handling all application requests -->
>        <servlet>
>                <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
>                <servlet-class>
>                        org.springframework.web.servlet.DispatcherServlet
>                </servlet-class>
>                <init-param>
>                        <param-name>contextConfigLocation</param-name>
>                        <param-value></param-value>
>                </init-param>
>                <load-on-startup>2</load-on-startup>
>        </servlet>
>
>        <!-- Map all /spring requests to the Dispatcher Servlet for handling
> -->
>        <servlet-mapping>
>                <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
>                <url-pattern>/spring/*</url-pattern>
>        </servlet-mapping>
>
>        <!-- Just here so the JSF implementation can initialize, *not* used
> at
> runtime -->
>        <servlet>
>                 <servlet-name>Faces Servlet</servlet-name>
>
>  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>                <load-on-startup>1</load-on-startup>
>        </servlet>
>
>        <!-- Just here so the JSF implementation can initialize -->
>         <servlet-mapping>
>                <servlet-name>Faces Servlet</servlet-name>
>                 <url-pattern>*.faces</url-pattern>
>        </servlet-mapping>
>
>        <welcome-file-list>
>                <welcome-file>index.html</welcome-file>
>        </welcome-file-list>
>
> </web-app>
>
>                            </fieldset>
>
>                        </tr:form>
>
> here's my searchCriteria:
>
>
>    private org.apache.myfaces.trinidad.model.UploadedFile testUploadedFile
> = null;
>
>    public org.apache.myfaces.trinidad.model.UploadedFile
> getTestUploadedFile() {
>        System.out.println("\n\ngetTestUploadedFile -> " +
> testUploadedFile);
>        return testUploadedFile;
>    }
>
>    public void
> setTestUploadedFile(org.apache.myfaces.trinidad.model.UploadedFile
> testUploadedFile) {
>        System.out.println("\n\nsetTestUploadedFile -> " +
> testUploadedFile);
>        this.testUploadedFile = testUploadedFile;
>    }
>
>
> My setters/getters are never called.   Ideas anyone ??  really appreciate
> it...
>
> thanks
>
>
> --
> View this message in context:
> http://old.nabble.com/file-upload-using-spring-web-flow-tp27729131p27729131.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>