1)Action映射是指:
在struts.xml中指定action执行的方法,如:<action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
一:name="findgoodstype" 即为调用action时使用的名称,调用方法为:findgoodstype.action。
二:class="com.myStruts.web.action.GoodsTypeAction" 是定向要到哪个java文件中,前提保证是:在com.myStruts.web.action包目录结构中要有GoodsTypeAction.java文件。
三:method="findGoodsType" 即为action要执行的方法,前提保证:在GoodsTypeAction.java文件中要有名为findGoodsType的方法。
2)Action中传递参数:
<action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
<param name="kind">child</param>
</action>
其中param name="kind",kind是传递的参数名,child为参数传递的值,该参数值在findGoodsType方法中可用ServletActionContext.getRequest().getParameter("kind")方法获得。
3)跳转到相应页面:
<action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
<param name="kind">child</param>
<result name="goodstype">stype.jsp</result>
</action>
其中result name="goodstype"中的goodstype为findGoodsType方法的返回值,可用return "findGoodsType";方式实现,stype.jsp为将要跳转到的jsp页面。
struts.xml文件的配置方法还有很多,以上只是常用的。
分享到:
相关推荐
struts.xml配置文件详解struts.xml配置文件详解struts.xml配置文件详解
绝对的好东西 struts2.0中struts.xml配置文件详解
Struts-config.xml配置详解,介绍Struts-config中8个元素配置方法。
NULL 博文链接:https://wellfrog.iteye.com/blog/612014
struts2.0中struts.xml配置文件详解
韩顺平视频配套struts-config.xml配置详解.txt
Struts-config.xml 配置详解.doc Struts-config.xml 配置详解.doc
如果设置为true,Struts2将加载XML配置文件;否则,不加载。 5. struts.continuations.package:这是一个包名,包含使用Rife continuations的actions。 6. struts.custom.i18n.resources:这是一个附加的国际化...
struts1 web.xml struts1配置
这个strut-config配置详解是韩顺平老师指定的 很多同学都看过韩老师的视频或者上过韩老师的课程吧
Struts-config.xml 配置文件详解 Struts-config.xml 是 Struts 框架的主要配置文件,用于配置 Struts 应用程序的各种设置。在该文件中,可以配置数据源、Form Bean、Action 和插件等信息。下面是 Struts-config.xml...
是否加载xml配置(true,false) struts.continuations.package The package containing actions that use Rife continuations 含有actions的完整连续的package名称 struts.custom.i18n.resources Location of ...
详细介绍struts.xml的属性配置,希望能帮助到各位,不足的地方请各位指教!
struts配置文件讲解。。。。。。。。。。。。。。。。。。。。。
struts-config.xml 文件详解 以下是一份完整的struts-config.xml文件,配置元素的说明详见注释.
本文档详细讲解了关于web工程中web.xml文件相关配置;希望对web开发者有一定的帮助。
SSH之Struts1之struts-config.xml常用配置详解(3-21-2008)
Struts2中struts_xml的Action配置详解