Java中使用通配符配置struts文件<单通配符和双通配符>

//使用Method--指明action类中具体方法名配置方法

<package name="purview" namespace="/purview" extends="struts-default">

<action name="gotoPurviewPage" class="purviewAction" method="gotoPurviewPage">

<result name="success">/WEB-INF/basic/purview/purviewList.jsp</result>

</action>

<action name="getNodes" class="purviewAction" method="getNodes" />

<action name="saveOrEditPurview" class="purviewAction" method="saveOrEditPurview" />

<action name="getPurviewObject" class="purviewAction" method="getPurviewObject" />

<action name="delPurview" class="purviewAction" method="delPurview" />

</package>


//举个列子----单通配符-模糊方法名

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>

<package name="template" namespace="/template" extends="struts-default">

<action name="*" class="templateAction" method="{1}">

<result name="showIndex">${relativeHtmlPathName}</result>

<result name="templateManager">/WEB-INF/page/back/template/templateManager.jsp</result>

<result name="editFtl">/WEB-INF/page/back/template/editftl.jsp</result>

<result name="saveFtl" type="chain">templateManager</result>

<result name="deleteTemplate" type="chain">templateManager</result>

<result name="addTemplate" type="chain">templateManager</result>

<result name="toAddTemplate">/WEB-INF/page/back/template/addFtl.jsp</result>

</action>

</package>

</struts>


//双通配符配置方法

<package name="topic" namespace="/topic" extends="struts-default">

    <action name="*_*" class="topicAction" method="{2}">

<result name="success" type="redirect">find_selAllTopic.action</result>

<result name="saveBefore">/WEB-INF/page/back/topic/addTopic2.jsp</result>

<result name="selAllTopic">/WEB-INF/page/back/topic/selTopic2.jsp</result>

<result name="findTopicById">/WEB-INF/page/back/topic/addTopic2.jsp</result>

<result name="sellAll" >/WEB-INF/page/back/topic/selTopic2.jsp</result>

<result name="sellAllByName" >/WEB-INF/page/back/topic/selTopic2.jsp</result>

<result name="sellAllBySubject" >/WEB-INF/page/back/topic/selTopic2.jsp</result>

<result name="error">/WEB-INF/page/back/examtype/error.jsp</result>

</action>

</package>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GFanStudio-LeeSir

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值