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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:46:02+00:00 2026-06-05T06:46:02+00:00

I have a MVC website with java technologies. I have a number of .jsp

  • 0

I have a MVC website with java technologies. I have a number of .jsp which when routed to via proper servlets work fine, but when accessed directly appear not to work. I want to prevent my users from direct addressing the .jsps.

That is they can use www.url.com/Website/MyServlet, which would then forward them to www.url.com/Website/MyServlet.jsp, but I want to prevent them from direct addressing towww.url.com/Website/MyServlet.jsp since the HttpServletRequest will be missing attributes and will not display correctly. Surely this must be common practice? How do I accomplice this, can I write a mapping which redirects all *.jsp to not founds unless it is a forward?

I bet I could write a filter that picks up all non FORWARD directives (INCLUDE REQUEST etc) mapped to *.jsp and send 404 for them but Im thinking there must be a eaisier way? Anyone have any suggestions?

  • 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-05T06:46:04+00:00Added an answer on June 5, 2026 at 6:46 am

    Put them in /WEB-INF folder and change the forward paths accordingly.

    request.getRequestDispatcher("/WEB-INF/MyServlet.jsp").forward(request, response);
    

    Files in /WEB-INF (and /META-INF) folder are not publicly accessible.

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

Sidebar

Related Questions

I have a an ASP .Net MVC website which works fine when testing locally.
I have an MVC application which is my marketing website, and two other regular
I have an MVC website which has 3 main components Member area which has
I have a MVC 3 website in which the contents are stored in the
I have a MVC website that was working fine on one dev machine. I
I have an ASP MVC 3 website which is used on the intranet. It
I have an ASP.net MVC website which is displaying numbers. Can I somehow determine
I have successfully hosted my mvc website on server. But I'm not able to
I have an asp.net mvc website which of course has a web.config file. I
I have an ASP.NET MVC website that connects to a DB via a Web

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.