• Post Reply Bookmark Topic Watch Topic
  • New Topic

preventing direct access to jsp pages  RSS feed

 
Jigar Gosar
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually the appln is very big, but im cutting short the details , to get to the core,

i have two pages, entername.jsp , displayname.jsp , and a controller servlet.

entername.jsp posts a message to servlet servlet forwards the request to displayname.jsp after doing all the error checking in the name feild.

my problem is, how can i avoid direct access to displayname.jsp , i only want my servlet to invoke displayname.jsp, and if client types name of displayname.jsp in his browser he should get error. how can i restrict direct access to displayname.jsp in my web application.

Please Help,

Thanks,
Jigar Gosar.
 
Atul Prabhu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jigar,

IN the servlet you can include


in display.jsp u can check whether some_var exists in the request or not.
If not throw a exception and show a error page.

Hope this works.

Regards
Atul
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Place the JSP pages in WEB-INF or a folder under WEB-INF. Containers cannot directly serve resources under WEB-INF.
 
Jigar Gosar
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, but is there any other way>>>???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's so hard about putting the files under WEB-INF?
 
Jigar Gosar
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nothing i was just curious.......
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!