Java 正则表达式Struts 1.3操作映射
据我所知,我正在使用Struts 1.3进行一个项目,因为它位于Struts-config-default.xml文件的顶部:Java 正则表达式Struts 1.3操作映射,java,struts,struts-1,struts-config,action-mapping,Java,Struts,Struts 1,Struts Config,Action Mapping,据我所知,我正在使用Struts 1.3进行一个项目,因为它位于Struts-config-default.xml文件的顶部: <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> 有没有办法将操作的通配符映射到
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
有没有办法将操作的通配符映射到jsp文件?我尝试过各种通配符变体:
<action path="/hello/candy" type="com.officedepot.globalweb.framework.action.ForwardDisplayAction">
<forward name="success" path="/WEB-INF/jsp/candyStore.jsp" />
</action>
我有一个在“candyStore.jsp”中加载的单页应用程序,因此我希望/hello/candy之后的所有URI和任何URI都路由到同一个jsp。(例如:www.site.com/hello/candy/pageOne、www.site.com/hello/candy/33/jellybean、www.site.com/hello/candy/test都应转发到jsp candyStore)
使用Struts 1.3是否有可能做到这一点,或者我是否应该编写所有可能的路由:(
谢谢!在您的操作文件中
public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request , HttpServletResponse response)
throws Exception{
//Perform any code here like error 404.
return mapping.findForward("unspecified");
}
在配置文件中的struts操作路径中
<forward name="unspecified" path="/candyStore.jsp"/>
在谷歌上大约30秒:
你不需要在转发的
路径中使用通配符
如果它不能解决你的意思,请发表评论,我将删除答案。由于答案太长,我不可能在评论中发布。否则我会。
<action-mappings>
<action path="/*Action" type="com.vaannila.reports.{1}Action" name="{1}Form">
<forward name="success" path="/{1}.jsp" />
</action>
</action-mappings>