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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:49:37+00:00 2026-05-20T04:49:37+00:00

I have a question I am struggling with. Just a hypothetical situation here. For

  • 0

I have a question I am struggling with. Just a hypothetical situation here. For example I have two folders jspPages1 and jspPages2. There are jsp pages I want to keep separated. I have one dispatcher servlet. And I want pages from the first folder to be mapped to “/public/jspNameFromFirstFolder.jsp” and from the second folder to “protected/jspNameFromSecondFolder.jsp”. Can I do that with one dispatcher servlet? If I try and make url patterns in web.xml to “/protected/’asteriks'” and “/public/’asteriks'”, what would @RequestMapping be like? Can you please clarify it for me? Thank you in advance.

  • 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-20T04:49:38+00:00Added an answer on May 20, 2026 at 4:49 am

    In my opinion, you shouldn’t expose your JSPs in the first place. After all, you want your user to access the page using the request mapping you provide. Your controller will then decide which view (in your case, they are JSP files) to present to the user.

    What I usually do is to stuff the views under WEB-INF directory to prevent users from guessing and accessing the JSP files directly. You can still keep the views separated if it helps you to organize your files. So, your directory structure may look like this:-

    WEB-INF
    |
    |- jsp
    |   |
    |   |-- public
    |   |    |
    |   |    |- page1.jsp
    |   |    |- page2.jsp
    |   |
    |   |-- protected
    |   |    |
    |   |    |- page3.jsp
    |   |    |- page4.jsp
    

    This way, you can register your view folder to be /WEB-INF/jsp/ in Spring MVC.

    Your request mapping can be anything you want. It has nothing to do with your view directory structure.

    For example:-

    // when your user visits /page-1.htm, it returns public/page1.jsp as the view
    @RequestMapping("/page-1")
    public String showPage1() {
        return "public/page1";
    }
    
    // when your user visits /secure/page-3.htm, it returns protected/page3.jsp as the view
    @RequestMapping("/secure/page-3")
    public String showPage3() {
        return "protected/page3";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about a problem I'm struggling with. Hope you can bear
Okay, so I have another question on a prolog homework problem I am struggling
I have been struggling with this question for awhile now, and I haven't reached
I have been struggling to find an answer to this theoretical question, even tho
I have Question and QuestionTypes. In Question table there is a foreign key that
I have posted this question on the Ext-GWT forums, I am just hoping that
I'm new to EMR and just had a few questions i have been struggling
Here is probably an easy question.. but I am really struggling so help is
quick question I'm struggling with, hopefully I've just got a brain-blockage and I'm missing
I'm struggling since a few hours with this design question. In Cocoa for example,

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.