Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A link in jsp point to another jsp without mapping

 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()).
 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic