J2EE(02) struts-config.xml 配置说明
2012-02-11 00:08
375 查看
(1) 在web.xml里面如何配置struts-config.xml 以及多个模块的分开配置
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
//下面就是配置了一个/debug/路径下的访问的请求
<init-param>
<param-name>config/debug</param-name>
<param-value>/WEB-INF/struts-debug-config.xml</param-value>
</init-param>
(2) 一个标准的action的配置
<action-mappings >
<action path="/sys" type="com.test.struts.action.SysActionAction" scope="request" parameter="oper" >
<forward name="FW_OK" path="/index.jsp" />
</action>
</action-mappings>
注意:
路径 /sys 前面要斜杠,名称就是今后访问的sys.do, type可以任意指定类路径
如果action继承的是Action,那么里面就要实现execute方法
如果继承的是DispatchAction,那么就任意写方法,参数同于execute方法,xml里面配置时,parameter="oper",表示
函数名放到oper字段里面,一般可以用隐藏域
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
//下面就是配置了一个/debug/路径下的访问的请求
<init-param>
<param-name>config/debug</param-name>
<param-value>/WEB-INF/struts-debug-config.xml</param-value>
</init-param>
(2) 一个标准的action的配置
<action-mappings >
<action path="/sys" type="com.test.struts.action.SysActionAction" scope="request" parameter="oper" >
<forward name="FW_OK" path="/index.jsp" />
</action>
</action-mappings>
注意:
路径 /sys 前面要斜杠,名称就是今后访问的sys.do, type可以任意指定类路径
如果action继承的是Action,那么里面就要实现execute方法
如果继承的是DispatchAction,那么就任意写方法,参数同于execute方法,xml里面配置时,parameter="oper",表示
函数名放到oper字段里面,一般可以用隐藏域
相关文章推荐
- struts-config.xml中配置数据库访问的data-sources元素说明
- 【转】struts1的struts-config.xml的配置说明
- Struts框架中struts-config.xml配置文件的作成说明
- 【Struts1.2总结系列】struts-config.xml配置
- struts-config.xml配置文件详解
- struts-config.xml配置文件详解
- iBATIS的配置文件sqlmapconfig.xml详细说明。
- struts 使用多个配置文件 struts-config.xml
- Struts的核心是struts-config.xml配置文件,本文详细描述了所有的Struts组件。
- 一个比较完整的Struts-config.xml配置文件
- 从IBatis2.X 移植到IBatis3.0 sqlMapConfig and sqlMap XML 配置文件升级说明
- struts-config.xml配置文件
- Struts-config.xml配置文件《action-mappings》元素的详解
- 02_MyBatis项目结构,所需jar包,ehcache.xml配置,log4j.properties,sqlMapConfig.xml配置,SqlMapGenerator.xml配置
- 配置多个struts-config.xml
- struts-config.xml配置文件详解
- 创建Struts 配置文件 (struts-config.xml)
- 在struts中以无参数的javabeans的方式调用struts-config.xml中配置的数据源
- 如何调用struts-config.xml中配置的data-source
- Struts-config.xml配置文件讲解