Problems with FileUpload
spigo Apr 13, 2009 6:06 AMHello,
First of all, thank you for all RichFaces team! great job!
I´m trying to use the richFaces component fileUpload and doesn´t work correctly.
I have copied the live demo code and I have the next problem. When I upload an image, the listener is working correctly but the onuploadevent doesn´t fire in my web page and the panelGroup component "info" doesn´t rendered. Furthermore, I have an strange behaviour in my back bean. The constructor is called more than one time and I lost the upload data.
The order execution is the following:
1º Upload file
2º Back bean is called (two times!!!!!) New instances.
3º The uploadListener is called and gets the data correctly.
4º Back bean is called again two times !!! New instances.
5º The method paint doesn´t called never.
6º The upload component shows the info correctly but the panelGroup that contains the mediaOutput doesn´t working correctly
Why my back bean is called more than one time!?!? Can I Have a config problem with richfaces!? I can save the image, but never show it..
The version that I am using are the followings:
RichFaces 3.3.0 GA and jsf-mojarra-1.2.12
web.xml
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <description>debug web.xml</description> <context-param> <param-name>com.sun.faces.compressViewState</param-name> <param-value>enabled</param-value> </context-param> <context-param> <description>Comma separated list of URIs of (additional) faces config files.(e.g. /WEB-INF/my-config.xml) See JSF 1.0 PRD2, 10.3.2 Attention: You do not need to put /WEB-INF/faces-config.xml in here.</description> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value>xxx</param-value> </context-param> <context-param> <description>State saving method: "client" or "server" (= default) See JSF Specification 2.5.3</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <description> This parameter enables partial state saving. </description> <param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name> <param-value>false</param-value> </context-param> <context-param> <description> If true every time a page is rendered, the corresponding JSP is dispatched also. This is very usefull if Scriptlets are used inside the JSP. </description> <param-name>javax.faces.PARTIAL_STATE_SAVING_DISPATCH_EVERY_TIME</param-name> <param-value>false</param-value> </context-param> <context-param> <description>Makes Security View Handler printing debug messages at runtime</description> <param-name>com.groundside.jsf.security.print_debug_messages</param-name> <param-value>true</param-value> </context-param> <context-param> <description>Customize error message shown upon unauthorized access attempt</description> <param-name>com.groundside.jsf.security.unauthorized_access_error_messages</param-name> <param-value>User is not authorized to perform requested action</param-value> </context-param> <!-- Ajax4JSF filter --> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> <init-param> <param-name>createTempFiles</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>maxRequestSize</param-name> <param-value>1000000</param-value> </init-param> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <!-- Ajax4JSF filter --> <session-config> <session-timeout>120</session-timeout> </session-config> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet> <servlet-name>InitServlet</servlet-name> <servlet-class>com.xx.xxx.servlet.InitServlet</servlet-class> <init-param> <param-name>errorPage</param-name> <param-value>/jsp/error.jsp</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>InitServlet</servlet-name> <url-pattern>/InitServlet</url-pattern> </servlet-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>SourceCodeServlet</servlet-name> <servlet-class>org.apache.myfaces.shared_tomahawk.util.servlet.SourceCodeServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>SourceCodeServlet</servlet-name> <url-pattern>*.source</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list> <error-page> <error-code>500</error-code> <location>/jsp/error500.jsf</location> </error-page> <error-page> <error-code>404</error-code> <location>/jsp/error404.jsf</location> </error-page> <error-page> <error-code>403</error-code> <location>/jsp/error403.jsf</location> </error-page> <error-page> <error-code>400</error-code> <location>/jsp/error400.jsf</location> </error-page> </web-app>
any ideas???? Thanks!