aspose file tools
The moose likes JSP and the fly likes How to handle jsp's not being opened when we paste the url in another browser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to handle jsp Watch "How to handle jsp New topic
Author

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

ravisha andar
Ranch Hand

Joined: Feb 25, 2011
Posts: 55
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

Joined: Jan 10, 2002
Posts: 56531
    
  14

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
ravisha andar
Ranch Hand

Joined: Feb 25, 2011
Posts: 55
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

Joined: Jan 10, 2002
Posts: 56531
    
  14

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?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to handle jsp's not being opened when we paste the url in another browser
 
Similar Threads
Doubt in Cookies
Security Related Error in Servlet Application
Use jsp for 404 pg Sun One Web Server
Refresh Problem : same action gets called
How to Handle back button