正则表达式Struts 1.3操作映射

根据我的判断,我正在使用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">

有什么方法可以将操作的通配符映射到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都路由到同一JSP。(例如,www.site.com / hello / candy / pageOne,www.site.com / hello / candy / 33 / jellybean,www.site.com / hello / candy / test都应转发到jsp candyStore)


慕斯709654
浏览 181回答 2
2回答

斯蒂芬大帝

在您的动作文件中public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request , HttpServletResponse response)&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throws Exception{&nbsp; &nbsp; &nbsp; &nbsp; //Perform any code here like error 404.&nbsp; &nbsp; &nbsp; &nbsp; return mapping.findForward("unspecified");&nbsp; &nbsp; }在您的Struts动作路径中的配置文件<forward name="unspecified" path="/candyStore.jsp"/>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java