struts2 (2) struts2.xml配置文件
2016-11-02 20:25
357 查看
<struts> <package name="itcast" namespace="/test" extends="struts-default"> <action name="helloworld" class="cn.itcast.action.HelloWorldAction" method="execute" > <result name="success">/WEB-INF/page/hello.jsp</result> </action> </package> </struts>
package :包,和java包类似。主要管理一组业务功能相关的action。在实际中把一组业务功能相关的action放在同一包个下。配置包时必须指定name属性,并且唯一。如果要继承该包,必须通过name属性进行引用。
namespace:命名空间,作为访问action 路径的一部分,可以不配置,如果不配置则默认为“”(空字符串)。
通常每个包都会继承struts-default。struts的核心功能都是通过拦截器实现的。如请求参数封装到action,文件上传,数据验证。struts-default定义了这些拦截器和result类型。必须继承struts-default才能使用struts的核心功能。
struts-default包在struts-default.xml中定义,struts2 每次启动自动加载struts-default.xml文件。
包可以同步 abstract =true 定义问抽象包,抽象包中没有action。
相关文章推荐
- Struts2的struts2.xml配置文件
- Struts2的学习(1)--Struts2.xml文件的配置
- struts2的struts.properties配置文件详解
- Struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- struts2默认配置文件 struts-default.xml 研究
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- STRUTS2.x 初始化相关的配置信息文件及struts.properties详解
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件
- struts2 配置文件 struts.xml
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- 【Struts2.0】struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- Struts2使用4-- Struts2的配置2-- Struts.properties 属性文件