How to open one jsp from another through struts

17,883

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"/>
Share:
17,883
Van de Graff
Author by

Van de Graff

Updated on June 04, 2022

Comments

  • Van de Graff
    Van de Graff almost 2 years

    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?

  • dvhh
    dvhh over 13 years
    You are welcome, too bad no one else bothered to give another answer