facebook

JSF pages coming blank after applying servlet filters!

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #253514 Reply

    jbm
    Member

    I have a JSF page, which shows up fine (in both IE and Firefox) in normal scenarios. But as soon as I apply servlet filters on the faces extension(s), I get into trouble. So after setting up the filters, when I load the same page(s) in each of the browsers, the filters run fine in the background, but the page comes up blank (in both IE and FF). Happening only with JSF / Faces pages.

    Once I remove the filter mapping, the page loads up just fine.

    Would appreciate any feedback on this. TIA!

    Platforms:
    Tomcat 5.5.15
    JSF/Faces – Sun RI 1.2
    Servlet Spec: 2.4

    Portion of the Web.xml code (after applying the filters onto the faces components):

    :
    :
        <listener>
            <listener-class>
                com.sun.faces.config.ConfigureListener
            </listener-class>
        </listener>
    
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.faces</url-pattern>
        </servlet-mapping>
    
        <filter>
            <filter-name>PreProcessFilter</filter-name>
            <filter-class>.....view.util.PreProcessFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>PreProcessFilter</filter-name>
            <url-pattern>*.html</url-pattern>
        </filter-mapping>
        <filter-mapping>
            <filter-name>PreProcessFilter</filter-name>
            <url-pattern>*.jsp</url-pattern>
        </filter-mapping>
        <filter-mapping>
            <filter-name>PreProcessFilter</filter-name>
            <url-pattern>*.faces</url-pattern>
        </filter-mapping>
    #253516 Reply

    jbm
    Member

    Update:
    In normal scenarios, where the filter does not redirect or forward the request, the JSF page IS GETTING loaded fine.

    The problem (JSF page coming up blank) occurs only when the filter is redirecting or forwarding the request to another JSF page!

    Again, thanks for your time!

    #253529 Reply

    jbm
    Member

    Just changing the web.xml to the following solved it:

        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>[b]/faces/*[/b]</url-pattern>
        </servlet-mapping>
    
        <filter>
            <filter-name>PreProcessFilter</filter-name>
            <filter-class>com.qualcomm.mysource.view.util.PreProcessFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>PreProcessFilter</filter-name>
            <url-pattern>*.jsp</url-pattern>
        </filter-mapping>
    #253530 Reply

    jbm
    Member

    Ignore the tags in the web.xml snippet above…

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: JSF pages coming blank after applying servlet filters!

You must be logged in to post in the forum log in