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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:07:10+00:00 2026-05-26T18:07:10+00:00

I have a number of Java Server Pages set up already and I would

  • 0

I have a number of Java Server Pages set up already and I would like to use a Controller/View system by adding a Process Servlet (which extends HttpServlet).

I just want to basically process the requested JSPs as normal after the ProcessServlet has added some attributes.

Say all my JSPs are in a directory called /content/ and my web.xml file has a rule to map /content/*.jsp to my ProcessServlet

I have not been able to find a way short of moving all of my JSPs into a different directory (/content-JSPs/) so that they can be dispatched to without having to go through the ProcessServlet endlessly.

Is there a way to basically dispatch#forward() (some other method?) to the requested JSP without having it go through the ProcessServlet again?

It’s a bit hard to believe that this lack of flexibility exists. Why can’t the Servlet just act as a pass through to the JSP?

My goal here is to set everything up so that the web server does not have to have a separate directory for all JSPs and another directory for everything else i.e. CSS, JavaScript and images. I would like to keep the directory structure (and URL structure) as it is.

  • 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-26T18:07:11+00:00Added an answer on May 26, 2026 at 6:07 pm

    Put them in /WEB-INF folder. This also effectively hides JSPs away from direct access. You only need to change the RequestDispatcher#forward() call to include /WEB-INF in the path.

    request.getRequestDispatcher("/WEB-INF/content" + request.getPathInfo()).forward(request, response);
    

    Please note that the URL pattern of /content/*.jsp is syntactically invalid. It should be /content/*. Perhaps you have also really used that. To skip static resources like images/css/JS, you should just not put them in /content, but in for example /resources, /static, etc.

    Related:

    • Design Patterns web based applications
    • Hidden features of JSP/Servlet
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a number of classes which manipulate files in Java. I am
I have developed for a number of years in Java, primarily for Linux and
I have a Java method in which I'm summing a set of numbers. However,
Sites like StackOverflow count, save, and display the view counts for pages. How do
We've got a Java server application that runs on a number of computers, all
I have a C# client and a java server. I have data object that
I have an application that uses a cron like job to update a set
I would like to have some advices because I've got conflict between clients sending
I'm working on a reporting system using Java 6 and SQL Server 2008. For
I'm working on a project were we have number (5 at the moment) of

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.