Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle page controller and page Interaction seneraio in JSP?  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I have a page call "/jsp/mySomePage.jsp" and its page controller is "/somePageController"

I have configured all page request for "/jsp/mySomePage.jsp" to "/somePageController"

now question is suppose some one directly typed "/jsp/mySomePage.jsp" then I want that URL in the top bar should change to "/somePageController"

although I can restrict access to this page using filters but How to handle this display page seneraio?

I hope its clear If not please ask

Thanks
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a url rewrite tool like rewrite
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@E Armitge

If I am using Filters in Java Web Applications then is there any requirement of this tool?
http://www.ocpsoft.org/rewrite/
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The correct solution is to keep all jsps files under the WEB-INF folder (i.e. /WEB-INF/jsps) where they cannot be accessed by the browser at all. All requests then MUST go through a controlling servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J. Kevin has given you the correct answer. The JSPs should not be accessible via URL at all. And if someone types a bad URL (such as directly to a JSP -- but how would they know how to?) they should get a 404 error.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
millon dollar point for me :jumpingjoy:

Thanks to both of you :beerchug:

You saved my effort of 3 days :rolling:
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
placing resources inside WEB_INF is a great point
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WEN-INF, not WEB_INF. It must always be uppercase as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!