tags:

views:

16

answers:

1

How to open One jsp from another through Struts?

For example,

I have 2 JSPs, Page1.jsp & Page2.jsp.

Page1.jsp does not contain any Form.

Page2.jsp contains a Form.

I need a link on Page1.jsp which when clicked takes me to Page2.jsp.

What are the Actionmappings needed to be added to struts-config.xml?


Update:

I tried adding these lines in Page1.jsp

<html:link page="Page2.do">Page2</html:link>

<a href="Page2.do">Page2</a>

In struts-config.xml, the following Action-mapping

<action path="/Page2"
parameter="Page2.jsp"
type="org.apache.struts.actions.ForwardAction"/>


The "href" one works, while the one with "html:link" does not take me to Page2.jsp.

Why is that?

+1  A: 

with struts version 1.x ( in Page1.jsp ) :

<html:link action="/action"> 

then in struts-config.xml :

<action path="/action" forward="{path to }Page2.jsp"/>
dvhh
thanks dvhh! very clear answer.
Van de Graff
You are welcome, too bad no one else bothered to give another answer
dvhh