wood burning stoves*
The moose likes Struts and the fly likes A link in jsp point to another jsp without mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "A link in jsp point to another jsp without mapping" Watch "A link in jsp point to another jsp without mapping" New topic
Author

A link in jsp point to another jsp without mapping

david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
Hi guys,

In a struts project, I have a jsp webpage (A.jsp) which has a link to another jsp page B.jsp , since one jsp page only can contain one ActionForm for user input(as I know), a.jsp and b.jsp each as a different ActionForm. So I want to put a link in a.jsp so user can click it and jump to b.jsp page without going through action and mapping stuff. Is that applicable? I just do not want to have a action class that do nothing but only used to point to a jsp file.

If applicable, how should I set the href link so B.jsp can be found? since all jsp file are under WEB-INF, i do not know how to find B.jsp.

Thanks for the help.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
tony xue wrote:since all jsp file are under WEB-INF, i do not know how to find B.jsp.


You'll either have to move them to a folder that's accessible to the clients, or serve them through a servlet, which based on the GET parameters forwards to the requested jsp (getRequestDispatcher().forward()).


OCJP 6 (93%)
david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
Thank you Lorand. "serve them through a servlet" is what I said use a action class which only does one thing:forward the request to jsp file. Since making client accessible to jsp file is not secure, so seems i have to use forward method through action class and mapping (in struts-config). Thanks for the help again.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
tony xue wrote:Since making client accessible to jsp file is not secure


Why do you think that..? The same content is accessible to them if you forward to the JSP using a servlet/action!
 
wood burning stoves
 
subject: A link in jsp point to another jsp without mapping
 
Similar Threads
relative path confusion
Popup window using Struts
Changing the URL when using forward or redirect...
send value using response.sendRedirect()
doubt on redirect