PrimeFaces on Tomcat - problems

Components, Ajax Framework, Utilities and More.
Post Reply
primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

20 Jan 2011, 00:15

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:

Code: Select all

 <h:body>
        <h:form>
        <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}" allowTypes="*.docx" label="Upload"  />
        </h:form>
    </h:body>
My ManagedBean:

Code: Select all

@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

Code: Select all

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.

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

20 Jan 2011, 06:34

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
----------

Code: Select all

<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>

primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

25 Jan 2011, 13: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.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider] and 4 guests