摘要: Struts2后缀, 1、struts.xml,其中value可变。 访问路径:http://localhost:8080/HelloWord/helloword_add.html 2、web.xml,其中<param-value>html</param-value>值可变。 访问路径:http:/ 阅读全文
posted @ 2016-07-25 17:24 smilelily126 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 默认Action,所有未找到路径显示error.jsp页面。 <default-action-ref name="index"></default-action-ref><action name="index"> <result>/error.jsp</result></action> struts 阅读全文
posted @ 2016-07-25 17:10 smilelily126 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 指定多个配置文件<include file="***.xml"></include> struts.xml helloword.xml 阅读全文
posted @ 2016-07-25 16:54 smilelily126 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 动态方法调用就是为了解决一个Action对应多个请求的处理,以免Action太多。 1、指定method属性 struts.xml 访问路径: http://localhost:8080/HelloWord/addAction.action http://localhost:8080/HelloWo 阅读全文
posted @ 2016-07-25 16:30 smilelily126 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Action搜索顺序http://localhost:8080/struts2(项目名)/path1/path2/path3/helloword.action根据struts.xml文件进行判断第一步:判断package是否存在,如:path1/path2/path3/ 存在:第二步:判断acito 阅读全文
posted @ 2016-07-25 16:26 smilelily126 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 访问Servlet API,Struts2提供了三种方式去访问Servlet API。ActionContext实现***Aware接口ServletActionContext 阅读全文
posted @ 2016-07-25 16:25 smilelily126 阅读(104) 评论(0) 推荐(0) 编辑
摘要: web.xml 任何MVC框架都需要与Web应用整合,这就得借助于web.xml文件,只有配置在web.xml文件中Servlet才会被应用加载。通常,所有的MVC框架都需要Web应用加载一个核心控制器,对于struts2框架而言,需要加载StrutsPrepareAndExecuteFilter, 阅读全文
posted @ 2016-07-25 15:34 smilelily126 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 以struts-2.3.24为例。 搭建Struts2环境步骤: 1、下载相关jar包 Apache Struts官方网站 http://struts.apache.org/、http://people.apache.org/builds/struts/ struts-2.5.2\apps :样例包 阅读全文
posted @ 2016-07-25 10:46 smilelily126 阅读(152) 评论(0) 推荐(0) 编辑