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>
<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>
相关文章推荐
- spring配置文件<import>标签中使用${}占位符获得配置文件的属性值
- java的web配置文件的“<load-on-startup>的说明[转]
- <Java>使用String读取文件名称获取得定位置的字符串
- spring框架,可以没有spring.xml(即配置<beans>的文件吗?即不使用xml方式配置,而是只使用注解的方式配置
- Spring配置文件<context:property-placeholder>标签使用
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Spring配置文件<context:property-placeholder>标签使用漫谈
- spring配置文件中<context:property-placeholder />的使用
- grunt <% %>模板和使用配置文件
- java的web配置文件的“<load-on-startup>的说明
- centos shell基础 alias 变量单引号 双引号 history 错误重定向 2>&1 jobs 环境变量 .bash_history source配置文件 nohup & 后台运行 cut,sort,wc ,uniq ,tee ,tr ,split, paste cat> 2.txt <<EOF 通配符 glob模式 发邮件命令mail 2015-4-8 第十二节课
- struts.xml配置文件中result的语法:<result name="" type="">xxxxx</result>
- 关于使用注解的Spring配置文件的配置<context:annotation-config/>&&<context:component-scan base-package=”XX.XX”/>
- spring配置文件中<context:property-placeholder />的使用
- 只有在配置文件或 Page 指令中将 enableSessionState 设置为 true 时,才能使用会话状态。还请确保在应用程序配置的 <configuration>\<system.web>\<httpModules> 节中包括..
- struts.xml配置文件中result的语法:<result name="" type="">xxxxx</result>
- 【区块链】以太坊 web3j for java 配置和使用 <1>
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Mybatis IBatis的Mapper配置文件中使用大于号好小于号 :>和<
- SPRING IN ACTION 第4版笔记-第二章WIRING BEANS-008-在XML配置文件中引入JAVA配置文件 <import> 、<bean>