Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:36:47+00:00 2026-06-17T15:36:47+00:00

In my JSF2.1 web application using PrimeFaces 3.4.2, I have added a new web

  • 0

In my JSF2.1 web application using PrimeFaces 3.4.2, I have added a new web page containing only one view with renderKitId="PRIMEFACES_MOBILE" (PFM 0.9.3). The idea is that a filter redirects requests coming from mobile devices to this page. Unfortunately this filter is completely breaking the css of the mobile page on some mobile devices (yes, not all devices are affected!). When the filter is there, either the redirected calls and the direct ones are broken on affected devices; when the filter is off, everything works fine.

Here the web filter:

public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain)
        throws IOException, ServletException {

    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse resp = (HttpServletResponse) response;

    boolean isMobile = isMobileDevice(req.getHeader("user-agent"));  // utility function

    if (!req.getRequestURI().contains("/mobile/") && isMobile) {
        resp.sendRedirect(req.getContextPath() + "/faces/mobile/index.xhtml");
    } else {
        chain.doFilter(request, response);
    }    
}

The filter doesn’t have any mapping in web.xml. Only the annotation @WebFilter("/*") is present. When the path inside the annotation is faked, everything works well.

The xhtml page is … fairly simple:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pm="http://primefaces.org/mobile" >
    <h:head>
    </h:head>
    <h:body>
        <f:view renderKitId="PRIMEFACES_MOBILE">
            <pm:page title="Hello World">
                <pm:view id="main">
                    <pm:header title="Header" />
                </pm:view>
            </pm:page>        
        </f:view>    
    </h:body>
</html>

Additional info about the affected devices here.
I have no hint about how to debug this. I have looked into the generated html using Firebug, but wasn’t able to detect any difference between the working one and the other.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:36:48+00:00Added an answer on June 17, 2026 at 3:36 pm

    You need to let the filter skip JSF resource requests on CSS/JS/image files.

    if (req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) {
        chain.doFilter(request, response);
        return;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a
I have written a jsf2 (cdi) web-application, using jQuery, a syntaxhighlighting script lib. On
I have a small web application where I am using Spring, Hibernate and JSF2.0.
I have a web app. I am using JSF2 framework. My problem started when
I am using jsf2.0 with primefaces.My application was working fine with all browsers includes
In my JSF 2 - Primefaces 3 web application, I am using <p:panelGrid> and
I'm developing JSF 2 web application and using implicit navigation from page to page
I have created web-application using JSF 2.0 where I have checkbox to select as
I have created web-application using JSF 2.0 where I have many checkboxes. I want
I have created web-application using JSF 2.0 & JSP and facing some weird problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.