• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle jsp's not being opened when we paste the url in another browser

 
ravisha andar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii All,

SUppose i have a url to a jsp that is i am redirecting to a jsp from my servlet (the url will we displayed on the browser as http://abc.com/jsp/test.jsp)
If I copy the url and pate in other browser the page opens which actually should not happen
I handle this by using a session variable
Is there any better way to do it.

Any Help is highy appreciated !!!

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs should never be directly addressable. The should be placed in a folder under WEB-INF so that they cannot be directly served.

You should be forwarding, not redirecting to the JSP from its controller.

Please read this article for more info.
 
ravisha andar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

What is the advantage of forwarding over redirecting.

One more question : How about a servlet
if I paste http://abc.com/action.do( for example a file download servlet) in any browser the code(file download) executes.

How do i prevent it ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ravisha andar wrote:What is the advantage of forwarding over redirecting.

Did you read the article? If you did, what part of the Page Controller pattern confused you? If you didn't, then read it.

How do i prevent it ?

You don't.

What actual problem are you trying to address?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic