Search code examples
strutsstruts-1

Struts 1.3.8 simple page link without validation


I am working for a while with Struts 1.3.8 and I need to link my new .jsp file and avoid all validation I have in project.

I've got simple code in my loggin.jsp file:

 <html:link page="/lookPage">Look</html:link>

Now, I want to redirect it from loggin.jsp to another .jsp file with some informations for all vievers, not only logged users.

In my struts-config.xml file I set:

<action path="/lookPage" validate="false" name="lookPage">
    <forward name="lookPage" path="lookPage.page" />
</action>

and in another xml file my definition of .page name:

<definition name="lookPage.page" path="/jsp/common/lookPage.jsp" />

Unfortunately I've got error 404 not found. Can someone help a little?


Solution

  • For only forwarding I use definition of action.

    <action path="/lookPage" forward="lookPage.page" validate="false"></action>
    

    In jsp page use

    <html:link action="/lookPage">Link</html:link>
    

    in web.xml I have definition of struts servlet.

    <servlet>
      <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    .....
    

    and mapping

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    

    and my link looks like

    <html:link action="/lookPage.do">Link</html:link>