![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javaWeb(Struct2)
lzz360
这个作者很懒,什么都没留下…
展开
-
Struct2 自定义拦截器
1 因为struct2 如文件上传,数据验证等功能都是由系统默认的 defalutStack中的拦截器实现的,所以我们定义拦截器需要引用系统默认的defalutStack 这样才不会影响struct2在的其它功能 struts.xml /WEB-INF/page/message.jsp原创 2013-12-06 15:03:18 · 2382 阅读 · 0 评论 -
简单的stuct2测试helloworld
配置步骤: 1 tomact:一定要吧路径配置到 Web-root ,不然会报错 2 在src中导入struct.xml "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">原创 2013-12-04 09:48:24 · 1530 阅读 · 0 评论 -
stuct2接收请求参数
接收请求参数 1: http://127.0.0.1:8080/struct2341/test/helloworld.do?id=123 这样对于的action类就会通过反射机制获得id名字匹配;用表单也可以使用post提交的 public class HelloWorldAction { private Integer id; private String message; pri原创 2013-12-05 10:37:14 · 1435 阅读 · 0 评论 -
Struct2处理的请求后缀
Struct2处理的请求后缀 //这样访问的时候就可以只用.do的后缀了,如:http://127.0.0.1:8080/struct2341/test/helloworld.do //这样.do 或 .action 都可以了原创 2013-12-05 10:33:36 · 1715 阅读 · 0 评论 -
Action中result的各种转发类型
Action中result的各种转发类型 1,dispatcher:默认值 ,内部定向 /WEB-INF/page/employeeAdd.jsp 2,redirect:浏览器重定向 /index.jsp 3, redirectAction 重定向到action //同一个包下的 actionname //不同包下的 XXX原创 2013-12-04 11:49:40 · 7295 阅读 · 0 评论 -
struct2访问或添加request/session/application
访问或添加request/session/application 1 通过ActionContext //这样放置 public String execute() { ActionContext ctx = ActionContext.getContext(); ctx.getApplication().put("app","lll"); ctx.getSe原创 2013-12-05 10:38:52 · 1330 阅读 · 0 评论 -
struct2动态方法调用和使用通配符定义action
动态方法调用和使用通配符定义action //1 如果想执行action中的其它方法可以使用 http://127.0.0.1:8080/struct2341/test/helloworld!add.action //这样就会执行add这个方法了 //2 使用通配符*,{1}就是第一个星号 //然后可以这样访问 http://127.0.0.1:8080/struct234原创 2013-12-05 10:40:05 · 2701 阅读 · 0 评论