This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP hyperlink to protected page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP hyperlink to protected page" Watch "JSP hyperlink to protected page" New topic
Author

JSP hyperlink to protected page

Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
Hello everyone,
I was wondering if there is a way I can hyperlink to protected page. Here is my reasoning, I have a jsp page that allows a user to add/delete items from a database. Once the user has added/deleted an item they are redirected to a confirmation jsp page. From this page I would like to allow the user to go back to the protected add/delete page in order to add/delete another item from the database. Can I do this using a hyper link or do I need to use a form whose action is a servlet in order to redirect the response back to the add/delete page. Here is the code I am trying, and is not working.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

It's not at all clear what yea mean by a "protected page".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
Sorry I mean a jsp page that is in the WEB-INF directory.
Here is by tree
WebPages
-WEB-INF
-view
-admin.jsp

I should add that a user name and password are needed in order to access this page.

Do I need to store the user name and password in a session in order to allow a hyperlink back to the admin.jsp page?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

The whole purpose for putting a JSP under WEB-INF is to prevent just what you are trying to do; so don't even try. A JSP page should never be invoked without its page controller. So your link should be to the page controller, not to the JSP page.
Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
Thank you :)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP hyperlink to protected page
 
Similar Threads
Include a jsp file , everytime a hyperlink is clicked
Generate PDF report from jsp
Shoud I use window.location.replace() with Struts?
Knowning which link was clicked (take 2)
session tracking remove item (urgent)