• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to redirect to JSP when files are under WEB-INF?  RSS feed

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have recently moved my JSPs to WEB-INF/jsp so that they are protected. I am now unable to redirect to a JSP since it attempts to access /myappcontext/WEB-INF/jsp/something.jsp.

Thoughts?

Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. JSPs under WEB-INF can only be the target of a forward.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats your recommendation?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That greatly depends on what your intent was.

You moved the JSPs to WEB-INF to protect them from redirects, and then seemed surprised that it worked? If you don't want them protected from browser access, why did you move them there in the first place?

Generally, JSPs should be protected from redirects, and only available via a forward through their page controllers.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My intent was to protect them from direct access, ie users accessing http://myapp.com/content/jsp/accountInfo.jsp.

I guess a new controller is the way to go!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no difference between a redirect and someone typing into the address bar.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok got it. I just added a new controller and now all works well. Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!