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 9112417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:43:49+00:00 2026-06-17T03:43:49+00:00

I have a JSF webapp with some standard JSF pages and backing beans. I

  • 0

I have a JSF webapp with some standard JSF pages and backing beans.
I am trying to use the urlPatterns parameter of the @WebServlet annotation to get my app pages served from a non-root path. Ex:

http://localhost/<appName>/<myPath>/index.xhtml  

where myPath = /web as shown in the code below.

This doesn’t seem to work. The application only response to requests made to:

http://localhost/<appName>/index.xhtml

The application is deployed in Tomcat 7.0.
And the following JSF dependencies:

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.1.16</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.1.16</version>
</dependency>

Any ideas?

import javax.faces.webapp.FacesServlet;

@WebServlet(urlPatterns = "/web",
            initParams = { @WebInitParam(name = "javax.faces.PROJECT_STAGE",
                           value = "Development") })
public class AppServlet implements Servlet {

    FacesServlet servlet = new FacesServlet();

    @Override
    public void destroy() {
        servlet.destroy();
    }

    @Override
    public ServletConfig getServletConfig() {
        return servlet.getServletConfig();
    }

    @Override
    public String getServletInfo() {
        return servlet.getServletInfo();
    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        servlet.init(servletConfig);
    }

    @Override
    public void service(ServletRequest req, ServletResponse resp)
            throws ServletException, IOException {
        servlet.service(req, resp);
    }
}
  • 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-17T03:43:51+00:00Added an answer on June 17, 2026 at 3:43 am

    The URL pattern of /web matches only and only the http://localhost/<appName>/web folder and not the subfolders and files like http://localhost/<appName>/web/index.xhtml as you seemed to expect. For that, you should use an URL pattern of /web/*.

    @WebServlet("/web/*")
    

    Unrelated to the concrete problem, this won’t work together with JSF as its own FacesServlet would not be invoked this way. Perhaps you actually need a servlet filter? Also, that web init parameter creates a <servlet><init-param> and not a <context-param> as usually required for JSF. Just in case you didn’t knew that.

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

Sidebar

Related Questions

When you use JSF, you'll have the controller servlet javax.faces.webapp.FacesServlet that will be mapped
I have a JSF webapp throwing an exception (see below) when I'm trying to
I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I have a JSF page that is included in other JSF pages (basically a
I have several jsf pages. I need to add dynamic breadcrumbs to the header.xhtml.
I have a JSF web client and a Java client that both use the
I am trying to get started with JSF 2.0. I am trying a basic
I have the following 3 simple pages in a JSF app. index.html start.html confirmSuccess.thml
I have a JSF webapp which is exhibiting the following behaviour: http://localhost/myapp/ returns the
I use this code in the JSF page <h:outputText value=#{writeBean.t} /> (and I have

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.