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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:16:19+00:00 2026-05-16T10:16:19+00:00

I want to put my JSF 2.0 xhtml files under WEB-INF\jsf. How do I

  • 0

I want to put my JSF 2.0 xhtml files under WEB-INF\jsf. How do I access them then? I know that anything inside WEB-INF isn’t exposed to the outside, so I need a controller to redirect me to the corresponding JSP, right? (This is also the model 2 pattern iirc).

Can I achieve this with a parameter inside web.xml/faces-config.xml? I think the FacesServlet is the controller of my webapp so it should serve this purpose?

And another question for understanding the Model 2 Pattern. Does every action have to go first to a servlet which then handles the next possible step? So a simple <a href="anotherPage.html" /> is forbidden in this pattern since it doesn’t go to the controlling servlet?

  • 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-16T10:16:20+00:00Added an answer on May 16, 2026 at 10:16 am

    I want to put my JSF 2.0 xhtml files under WEB-INF\jsf. How do I access them then?

    You cannot. Files in /WEB-INF folder are not directly accessible.

    There are two options to workaround the problem of JSF source files being public accessible.

    1. Map the FacesServlet on *.xhtml instead of *.jsf.

    2. Or, restrict direct access on *.xhtml by a <security-constraint> in web.xml.

      <security-constraint>
          <display-name>Restrict direct access to XHTML files</display-name>
          <web-resource-collection>
              <web-resource-name>XHTML files</web-resource-name>
              <url-pattern>*.xhtml</url-pattern>
          </web-resource-collection>
          <auth-constraint />
      </security-constraint> 
      

    See also:

    • Which XHTML files do I need to put in /WEB-INF and which not?
    • JSF Facelets: Sometimes I see the URL is .jsf and sometimes .xhtml. Why?

    And another question for understanding the Model 2 Pattern. Does every action have to go first to a servlet which then handles the next possible step?

    The FacesServlet already does that. It’s the controller. With JSF you already end up with a simple javabean as model and JSP/Facelets file as view. The FacesServlet as being the controller has already taken all the nasty work of request parameter gathering, validation, conversion, model updating and navigation from your hands.

    See also:

    • What components are MVC in JSF MVC framework?
    • JSF Controller, Service and DAO

    So a simple <a href="anotherPage.html" /> is forbidden in this pattern since it doesn’t go to the controlling servlet?

    No, it’s perfectly fine. The controller will kick in whenever needed. If the resource doesn’t need a controller (i.e. static resource), then you also don’t need to let it pass through some controller.


    In the future, please ask multiple questions in separate Stack Overflow questions.

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

Sidebar

Related Questions

I want to put template files in defferent directories. (foo/, bar/) How do you
I want to look at using JSF but I'm put off by what appears
I want to test a JSF Backing-Bean method isInProgress that delegates to a service
Where is the proper 'place' in JSF to put initialisation snippet that follows, in
I've got a value type that I want put into a map. It has
I have a page layout for my MOSS '07 site that I want put
I want to put a copyright notice in the footer of a web site,
I ran git status and listed below are some files that were modified/or under
In my JSF 2.0 Facelets application I have one glorious template that I want
I want put a button on android edittextpreference. I create a custom editextpreference: public

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.