Struts-config.xml配置文件《action-mappings》元素的详解 -...
来源:百度文库 编辑:神马文学网 时间:2024/04/28 21:24:49
Struts-config.xml配置文件《action-mappings》元素的详解 [转贴 2010-02-03 11:41:34]
字号:大 中 小
action-mappings
该元素用于将Action元素定义到ActionServlet类中,它含有0到多个 元素,其格式如下:
type="该Action的对应类的全路径"
name="该Action绑定的FormBean,与的Name属性值一致"
每个action子元素可包含一个或多个forward子元素。除了path、type和name属性外,action还具有如下属性:
l scope:指定ActionForm Bean的作用域(session和request),缺省为session。(可选);
l input:当Bean发生错误时返回的路径,在validate验证框架中错误显示的页面(可选);
l classname:指定一个调用这个Action类的ActionMapping类的全名。缺省用org.apache.struts.action.ActionMapping(可选);
l include:如果没有forward的时候,它起forward的作用(可选);
l validate:若为true,则会调用ActionForm的validate()方法或调用validate验证,否则不调用,缺省为true(可选)。
forward属性也是可选的。
action元素定义举例如下:
Example1.
Eg2. 有input属性的例子:
path="/userAction"
type="com.amigo.struts.action.UserAction"
name="UserForm"
scope="request"
validate = "false"
parameter="method" >
Eg3. 仅有JSP的action元素:
type="com.amigo.struts.action.CalcAction"
name="CalcForm"
scope="request"
validate="true"
input="/index.jsp">
首先,ActionServlet接到请求后调用ForwardAction的execute()方法,execute()根据配置的parameter属性值来forward到那个URI。
parameter="/default.jsp"
type="org.apache.struts.actions.ForwardAction" />
这样做的效果是:没有任何form被实例化,比较现实的情形可能是form在request更高级别的范围中定义;或者这个action被用作在应用程序编译好后充当系统参数,只需要更改这个配置文件而不需要重新编译系统。
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhoukang0916/archive/2009/05/23/4210029.aspx
标签:配置文件 Struts-config.xml 《action-mappings》 元素的详解 .
字号:大 中 小
action-mappings
该元素用于将Action元素定义到ActionServlet类中,它含有0到多个
name="该Action绑定的FormBean,与
每个action子元素可包含一个或多个forward子元素。除了path、type和name属性外,action还具有如下属性:
l scope:指定ActionForm Bean的作用域(session和request),缺省为session。(可选);
l input:当Bean发生错误时返回的路径,在validate验证框架中错误显示的页面(可选);
l classname:指定一个调用这个Action类的ActionMapping类的全名。缺省用org.apache.struts.action.ActionMapping(可选);
l include:如果没有forward的时候,它起forward的作用(可选);
l validate:若为true,则会调用ActionForm的validate()方法或调用validate验证,否则不调用,缺省为true(可选)。
forward属性也是可选的。
action元素定义举例如下:
Example1.
Eg2. 有input属性的例子:
type="com.amigo.struts.action.UserAction"
name="UserForm"
scope="request"
validate = "false"
parameter="method" >
Eg3. 仅有JSP的action元素:
name="CalcForm"
scope="request"
validate="true"
input="/index.jsp">
首先,ActionServlet接到请求后调用ForwardAction的execute()方法,execute()根据配置的parameter属性值来forward到那个URI。
type="org.apache.struts.actions.ForwardAction" />
这样做的效果是:没有任何form被实例化,比较现实的情形可能是form在request更高级别的范围中定义;或者这个action被用作在应用程序编译好后充当系统参数,只需要更改这个配置文件而不需要重新编译系统。
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhoukang0916/archive/2009/05/23/4210029.aspx
标签:配置文件 Struts-config.xml 《action-mappings》 元素的详解 .
Struts-config.xml配置文件《action-mappings》元素的详解 -...
struts 使用多个配置文件 struts-config.xml
Struts2中struts.xml的Action配置详解
Web.config配置文件详解
struts2的struts.properties配置文件详解
struts2的struts.properties配置文件详解
Struts2的struts.properties配置文件详解
struts2的struts.properties配置文件详解
Struts2的struts.properties配置文件详解
Struts配置文件详解
Struts2配置文件——struts.xml
struts2的struts.properties配置文件详解_东征岁月
Struts 2.0的Action讲解
Hibernate配置文件中映射元素详解
struts2.0之struts.xml详解
说说用xml做配置文件的优劣
Struts的web.xml模板代码
Struts的web.xml模板代码
Struts配置文件详细讲解
Struts中不同的Action和ActionForm组合
Struts 2.0的Action讲解 - Max On Java - BlogJava
log4j配置文件(xml版)
创建Web应用和Struts框架的配置文件
对Web.config配置文件的常见操作 - 洞幺人生 - 博客园