struts2--package配置
来源:互联网 发布:zblog数据库配置文件 编辑:程序博客网 时间:2024/05/15 06:33
Packages are a way to group actions, results, result types, interceptors, and interceptor-stacks into a logical configuration unit. Conceptually, packages are similiar to objects in that they can be extended and have individual parts that can be overridden by "sub" packages.
Packages
The package element has one required attribute, name
, which acts as the key for later reference to the package. The extends
attribute is optional and allows one package to inherit the configuration of one or more previous packages - including all interceptor, interceptor-stack, and action configurations.
Note that the configuration file is processed sequentially down the document, so the package referenced by an "extends" should be defined above the package which extends it.
The optional abstract
attribute creates a base package that can omit the action configuration.(没有action定义)
Attribute
Required
Description
name
yes
key to for other packages to reference
extends
no
inherits package behavior of the package it extends
namespace
no
see Namespace Configuration
abstract
no
declares package to be abstract (no action configurations required in package)
Simple usage
<struts>
<
package
name="employee"
extends
="struts-
default
" namespace="/employee">
<
default
-interceptor-ref name="crudStack"/>
<action name="list" method="list"
class
="org.apache.struts2.showcase.action.EmployeeAction" >
<result>/empmanager/listEmployees.jsp</result>
<interceptor-ref name="basicStack"/>
</action>
<action name="edit-*"
class
="org.apache.struts2.showcase.action.EmployeeAction">
<param name="empId">{
1
}</param>
<result>/empmanager/editEmployee.jsp</result>
<interceptor-ref name="crudStack">
<param name="validation.excludeMethods">execute</param>
</interceptor-ref>
</action>
<action name="save" method="save"
class
="org.apache.struts2.showcase.action.EmployeeAction" >
<result name="input">/empmanager/editEmployee.jsp</result>
<result type="redirect">edit-${currentEmployee.empId}.action</result>
</action>
<action name="delete" method="delete"
class
="org.apache.struts2.showcase.action.EmployeeAction" >
<result name="error">/empmanager/editEmployee.jsp</result>
<result type="redirect">edit-${currentEmployee.empId}.action</result>
</action>
</
package
>
</struts>
Inherit from more than one package
<struts>
<
package
name="employee"
extends
="struts-
default
, json-
default
" namespace="/employee">
<action name="list" method="list"
class
="org.apache.struts2.showcase.action.EmployeeAction" >
<result>/empmanager/listEmployees.jsp</result>
<result type="json">
<param name="root">employees</param>
</result>
</action>
</
package
>
</struts>
- struts2 package元素配置
- struts2 package 配置说明
- Struts2配置package
- struts2--package配置
- 【struts2】<package>的配置
- 【struts2】<package>的配置
- struts2的配置元素package
- struts2的配置元素package
- struts2的配置元素package
- Struts2学习之package配置
- Struts2 在Struts.xml配置包 package
- Struts2-struts.xml中<package>配置
- Struts2 Package
- Struts2.0 xml文件的配置(package,namespace,action)
- struts2系列学习笔记(5)---------------Action的package配置
- Struts2.0 xml文件的配置(package,namespace,action)
- 找不到Action映射的原因之一 --- Struts2的package配置
- Struts2的配置-1.关于package和action
- null id in XXXentity (don't flush the Session after an exception occurs。。。。(HIbernate 实体类包含关键字)
- 解决网络ping内外网成功,但浏览器等应用程序连不上网(视个人情况而定)
- Git 常用命令整理
- 【极客学院每日一课】Android系列之一:创建和使用Android模拟器
- 动态规划
- struts2--package配置
- linux后台开发必看书
- (android中的动态布局)关于Android下各个布局方式里面LayoutParams的用法
- Hibernate版本 支持 hibernate-jpa-2.0-api-1.0.0.Final.jar
- plsql developer调试触发器
- Python开发——re.sub
- struts标签之bean:write用法
- 程序员转型书商 年交易额千万元
- W5500 - 高性能TCPIP网络集成电路