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

  • SEARCH
  • Home
  • 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 976671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:47:04+00:00 2026-05-16T03:47:04+00:00

Is there a way I can tell my application to let every single page

  • 0

Is there a way I can tell my application to let every single page (let’s say .jsp pages) to go under faces context?

In my web.xml I easly can do a servlet-mapping similar to:

<servlet-mapping>
   <servlet-name>Faces Servlet</servlet-name>
   <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
   <servlet-name>Faces Servlet</servlet-name>
   <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

Where I can map every url including /faces/ virtual path or ending in .jsf to be processed by the servlet rapresenting the jsf engine.

But what if I want that everything in my application goes under the faces context?
I tried adding:

<servlet-mapping>
   <servlet-name>Faces Servlet</servlet-name>
   <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

But it seems that the application crashes immediately:

NAQ Exception in PhaseListener RESTORE_VIEW(1) afterPhase
java.lang.NullPointerException
 at net.sf.jsfcomp.clientvalidators.ValidatorResourceLoader.afterPhase(Unknown Source)
 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:92)
 at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:99)
 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
 at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
 at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
 at it.asg.utility.viewhandlers.UrlParameterViewHandler.renderView(UrlParameterViewHandler.java:116)
 at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
 at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
 at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
 at it.asg.utility.viewhandlers.UrlParameterViewHandler.renderView(UrlParameterViewHandler.java:116)
 at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)

What’s wrong? Is there a way to let faces context work for every page in my app?

  • 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-05-16T03:47:04+00:00Added an answer on May 16, 2026 at 3:47 am

    That’s not possible because *.jsp is to be parsed by the servletcontainer’s builtin JspServlet.

    You could in theory use an url-pattern of /*.

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    

    This will in practice however not work (disallowed by the FacesServlet) and it would only add unnecessary overhead to requests which doesn’t need to go through the whole JSF lifecycle.

    Try to not think/look for the hard/cumbersome way. Just use *.jsf and if necessary add a security constraint on *.jsp to block direct access to JSP as I suggested in your previous question. That’s the common practice.

    Alternatively, you can also upgrade from JSP to Facelets which is XHTML/XML based. This way you can use *.xhtml or even *.html as both the Facelets suffix and the FacesServlet mapping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way I can tell whether stderr is outputting to a file
Is there a way I can tell (other than in the SVN Log...because it
Is there a way I can tell how many times a form submit button
Is there a way I can tell the browser to wait to start on
Is there some way in Flex where I can tell when all of the
Can someone tell me if there is a way for me to use the
Can anyone tell me if there is a way to select a video from
Can you tell me if there's a way to dis- and enable junit.framework.Assert commands
Is there any way can declare a bean in just like JSP UseBean in
Is there a way you can tell windsor container to reload a component if

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.