Board index JavaServer Faces General PrimeFaces on Tomcat - problems

PrimeFaces on Tomcat - problems

Components, Ajax Framework, Utilities and More.

Post 20 Jan 2011, 00:15

Posts: 52
Hi,

I've been using PrimeFaces 2.2 RC2 on Glassfish 3 with great efficacy. However, now I am using it with Tomcat 6 for another project.

I installed the following libs:

jsf-api.jar
jsf-impl.jar
standard.jar (JSTL)
jstl.jar

I'm just testing with the fileUpload component. It renders correctly and seems to behave correctly at the client side. But then I realize it doesn't call my ManagedBean. In fact it seems to ignore all references to a fileUploadListener altogether.
My .xhtml:
 <h:body>
        <h:form>
        <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}" allowTypes="*.docx" label="Upload"  />
        </h:form>
    </h:body>


My ManagedBean:

@ManagedBean(name="fileUploadController")
@RequestScoped
public class FileUploadMBean {

 

       public void handleFileUpload(FileUploadEvent event) {
           
           String file = event.getFile().getFileName();
           System.out.println(event.getFile().getFileName());
         

       }

Nothing happens.

No errors or exceptions are generated.
Even changing
fileUploadListener="#{fileUploadController.handleFileUpload}"
to a random non-existing function does not generate any errors.

Am I missing something?
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 365
This filter (below) is required in your deployment descriptor, and watch
out for any conflicting java code containing @WebFilter annotations,
which can be a real pain to debug.

(clearly changes will and may be needed to the exact text included here...)

web.xml
----------

<filter>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter
        </filter-class>
        <init-param>
            <param-name>uploadDirectory</param-name>
            <param-value>c:\upload</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>


Posts: 52
Hi,

That worked. Thanks.

I had completely forgotten about that filter.

Thanks.
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Return to General