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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:15:05+00:00 2026-06-06T18:15:05+00:00

I have few pages in following structure. –Project |—WebContect |—-Admin/ * |—-Author/ * |—-Readonly/

  • 0

I have few pages in following structure.

--Project
  |---WebContect
      |----Admin/ *
      |----Author/ * 
      |----Readonly/ * 
      |----Index.jsp

I want to restrict the user from accessing Pages under Admin,Author and Readonly. I don’t want anybody to access these pages. And if somebody tries to do so, should be redirected to index.jsp.

The easiest solution that come in my mind is using a Filter, but I am trying to find if its possible to do using web.xml.

  • 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-06T18:15:10+00:00Added an answer on June 6, 2026 at 6:15 pm

    If you want that nobody is able to access those pages directly, just put them in /WEB-INF folder.

    Project
     `-- WebContect
          |-- WEB-INF
          |    |-- Admin
          |    |-- Author
          |    `-- Readonly
          `-- Index.jsp
    

    This way the pages are not publicly accessible, but only by a servlet which performs a forward. When the enduser attempts to access it directly, all he will get is a HTTP 404 error.

    An alternative is configuring a role-less <security-constraint>.

    <security-constraint>
        <display-name>Restrict direct access to certain folders</display-name>
        <web-resource-collection>
            <web-resource-name>Restricted folders</web-resource-name>
            <url-pattern>/Admin/*</url-pattern>
            <url-pattern>/Author/*</url-pattern>
            <url-pattern>/Readonly/*</url-pattern>
        </web-resource-collection>
        <auth-constraint />
    </security-constraint>
    

    When the enduser attempts to access them, all he will get is a HTTP 403 error.

    Either way, it isn’t possible to redirect the enduser to index.jsp this way. Only a Filter can do that. You could configure the index.jsp as error page location for 404 or 403

    <error-page>
        <error-code>404</error-code>
        <location>/index.jsp</location>
    </error-page>
    

    But this would cover all 404’s (or 403’s), not sure if that is what you want.

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

Sidebar

Related Questions

I have a few pages and want that they use one style. See in
i have two websites, both websites contains few pages, and wordpress blog, please following
I have a few pages that needs a userId to work, thus the following
I have a few pages on my asp.net website that I would like to
I have a few static pages that are just pure HTML, that we display
I'm trying to redirect a few pages to a new domain and I have
I have a head file which I am using for a few different pages.
I have few nested DIVs at page. I want to add event only for
This is for a simple web-page assignment. I have a few pages on which
I have a few aspx pages which displays GridView controls. In each control I

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.