您的位置:首页 > 编程语言 > Java开发

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

2014-03-25 00:00 309 查看
//使用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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐