Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Restricting access to the view (JSPs)

 
Todd Johnson
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on my first STRUTS project. I have done some MVC web apps before. Typically I would have my controller servlet put a boolean on the request before forwarding it to my JSPs. My JSPs would check for that boolean to be there. If it wasn't there, the JSP would know that the user pointed their browser at the JSP instead of being forwarded to the JSP by the controller. In that case I would just forward them back to some "safe" place.

I'd like to do the same thing in struts, but the only way I can think to do it is to extend strut's action servlet. However, from what I have read, this is a bad idea. Is there another alternative that I am missing?

Thanks!
Todd
 
Mark Blackledge
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, put your JSP files somewhere under your WEB-INF directory. Then the users have no access to them and you don't have any extra work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic