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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:29:45+00:00 2026-06-09T11:29:45+00:00

I am using a Servlet Filter in my JSF application. I have three groups

  • 0

I am using a Servlet Filter in my JSF application. I have three groups of Web pages in my application, and I want to check Authentication for these pages in my Servlet Filter:

my Folders

/Admin/ *.xhtml

/Supervisor/*.xhtml
/Employee/*.xhtml

and I am writing web.xml like

<filter>
    <filter-name>LoginFilter</filter-name>
    <filter-class>com.ems.admin.servlet.LoginFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>LoginFilter</filter-name>
    <url-pattern>/Employee/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>LoginFilter</filter-name>
    <url-pattern>/Admin/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>LoginFilter</filter-name>
    <url-pattern>/Supervisor/*</url-pattern>
</filter-mapping>

but requests like

http://localhost:8080/EMS2/faces/Html/Admin/Upload.xhtml

are not entering into Filter.

I have to provide security to these 3 folders.

How to solve this problem ?

  • 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-09T11:29:47+00:00Added an answer on June 9, 2026 at 11:29 am

    If an URL pattern starts with /, then it’s relative to the context root. The /Admin/* URL pattern would only match pages on http://localhost:8080/EMS2/Admin/* (assuming that /EMS2 is the context path), but you have them actually on http://localhost:8080/EMS2/faces/Html/Admin/*, so your URL pattern never matches.

    You need to prefix your URL patterns with /faces/Html as well like so:

    <url-pattern>/faces/Html/Admin/*</url-pattern>
    

    You can alternatively also just reconfigure your web project structure/configuration so that you can get rid of the /faces/Html path in the URLs so that you can just open the page by for example http://localhost:8080/EMS2/Admin/Upload.xhtml.

    Your filter mapping syntax is all fine. However, a simpler way to specify multiple URL patterns is to just use only one <filter-mapping> with multiple <url-pattern> entries:

    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/faces/Html/Employee/*</url-pattern>
        <url-pattern>/faces/Html/Admin/*</url-pattern>
        <url-pattern>/faces/Html/Supervisor/*</url-pattern>
    </filter-mapping>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following filter to enable NTLM Authentication, in my web-application. I get
I plan to configure weblogic's gzip servlet filter (using weblogicx-gzip.jar) to gzip my web
We are using OpenSessionInViewFilter in our JSF 1.1 web application which is using Spring
I am working on a web app using JSF w/Seam. I want to be
I'm doing a Web application using Spring 3.1.0.RELEASE, JSF 2.x, JPA 2 with Hibernate
We have servlet filter which verifies couple of session variables before JSF view display.
On my web application, i have 2 main sections User Admin I am using
so i am using a filter to catch servlet exception (because we are using
i want to send arabic data from servlet using HTTPServletResponse to client i am
I have an applet that communicates with a servlet using Http (Not sockets). Currently,

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.