<?xml version = "1.0" encoding = "ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-Apache SoftWare Foundation//DTD Struts Configuration 1.1/EN"
"http://jakarta.apache.org/struts/dtd/struts-config_1_1.dtd">
<!--
This is the Struts configuration file for the "Hello!" sample application
-->
<struts-config>
<!--==========================Form Bean Definitions=======================-->
<form-beans>
<form-bean name = "HelloForm" // 页面中表单对应的Bean存储表单数据, 验证
type = "hello.HelloForm" // FormBean 对应的包名.类名
/>
</form-beans>
<!--========================Global-forwards=======================-->
<!--
<global-forwards>元素用来声明全局的转发关系. 由0个或多个<forward>元素组成. <forward> 元素用于将一个逻辑名映射到特定的URL. 通过这种方式, Action类或者JSP文件无需指定实际的URL, 只要指定逻辑名就能实现请求转发或者重定向.
-->
<global-forwards>
<forward name = "forward1" // 转发路径的逻辑名, 此项必须有
path = "/Action1.do" // 指向转发或重定向的URI. 此项是必需的, 必须以"/"开头.
/>
<forward name = "forward2" path="/Action2.do"/>
<forward name = "forward3" path="/jsp3.jsp"/>
</global-forwards>
<!--
如果jsp1.jsp把请求转发给Action1, 可以使用以下代码:
<html:link forward = "forward1">
或:
<logic:forward name = "forward1">
如果Action1的execute()方法把请求转发给jsp1.jsp
return (mapping.findForward("forward1"));
-->
<!--=========================Action Mapping Definitions=======================-->
<action-mapping>
<action path = "/HelloWorld" // 请求访问Action的路径, 必须以"/"开头
type = "hello.HelloAction" // Action的完整类名
name= "HelloForm" // 要传给Action 的ActionForm Bean
scope = "request" // ActionForm Bean 的存放范围
validate= "true" // 是否执行表单验证
input = "/hello.jsp" // 当表单验证失败时转发的路径, 必须以"/"开头
>
<forward name = "SayHello" // 键值用于标识此forward
path = "/hello.jsp" // 请求转发的路径, 必须以"/"开头
/>
</action-mapping>
<!--
<action>元素配置了HelloAction组件, 对应的类为hello.HelloAction, 请求访问路径为 "HelloWorld", 当Action 类被调用时, Struts 框架应该把已经包含表单数据的HelloForm Bean传给它. HelloForm Bean 存放在request范围内, 并且在调用Action 类之前应该进行表单验证, 如果表单验证失败, 请求将被转发到接收用户输入的网页 hello.jsp, 让用户纠正错误.
-->
<!--=================Message Resources Definitions=================-->
<message-resource
parameter = "hello.application" // 指定使用的消息资源文件
// hello.application 表明
// 消息资源文件名为"application.properties"
// 存放路径为
// WEB-INF/classes/hello/application.properties
/>
</struts-config>
这些配置信息在系统启动时, 被存入内存中, 供Struts运行期间使用. 在内存中每个<action>元素都对应一个org.apache.struts.action.ActionMapping 类的实例 .
分享到:
相关推荐
struts-config.xml struts标准配置文件 struts-config
struts-config.xml配置文件对学struts的人必备的查找资料。
Struts框架中struts-config.xml文件配置小结
struts-config.xml配置文件 struts-config.xml配置文件 struts-config.xml配置文件
配置 struts-config.xml 元素 属性的详解!转载来的,,看着很好!》希望对大家有用!
Struts-config.xml配置详解,介绍Struts-config中8个元素配置方法。
韩顺平视频配套struts-config.xml配置详解.txt
struts-config.xml配置文件详解
SSH之Struts1之struts-config.xml常用配置详解(3-21-2008)
struts-config.xml 详解struts-config.xml 详解
这个strut-config配置详解是韩顺平老师指定的 很多同学都看过韩老师的视频或者上过韩老师的课程吧
【Struts1.2总结】struts-config.xml配置
struts-config.xml 文件详解 以下是一份完整的struts-config.xml文件,配置元素的说明详见注释.
struts--config.xml详解
Struts-config.xml 配置详解.doc Struts-config.xml 配置详解.doc
2.5.10.1.jar,struts2-config-browser-plugin-2.5.10.1.jar,struts2-convention-plugin-2.5.10.1.jar,struts2-dwr-plugin-2.5.10.1.jar,struts2-embeddedjsp-plugin-2.5.10.1.jar,struts2-gxp-plugin-2.5.10.1....
struts-config.xml配置总结,嗯,有自己的经验,也有别人的经验,我总结了下,并做成了chm格式的文件。应该是比较全面的了吧。
J2EE struts框架开发struts-config.xml配置