I am working on a project using Struts 1.3 from what I can tell, given that this is at the top of the struts-config-default.xml file:
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
Is there any way to go about mapping a wildcard for an action forward to a jsp file? I have tried all sorts of wildcard variations:
<action path="/hello/candy" type="com.officedepot.globalweb.framework.action.ForwardDisplayAction">
<forward name="success" path="/WEB-INF/jsp/candyStore.jsp" />
</action>
I have a single page application that gets loaded in the 'candyStore.jsp' so i would like all and any URIs after /hello/candy to route to the same JSP. (eg. www.site.com/hello/candy/pageOne, www.site.com/hello/candy/33/jellybean, www.site.com/hello/candy/test all should forward to the jsp candyStore)
Is this at all possible using Struts 1.3 or should I be writing all the possible routes :(
Thanks!
In your action file
public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request , HttpServletResponse response)
throws Exception{
//Perform any code here like error 404.
return mapping.findForward("unspecified");
}
In your struts action path in config file
<forward name="unspecified" path="/candyStore.jsp"/>
About 30 seconds on Google:
<action-mappings>
<action path="/*Action" type="com.vaannila.reports.{1}Action" name="{1}Form">
<forward name="success" path="/{1}.jsp" />
</action>
</action-mappings>
You would not require the wildcard in the forward's path
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.