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.
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%)
Joined: Apr 10, 2009
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.
Joined: Oct 08, 2009
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!
subject: A link in jsp point to another jsp without mapping