《strucs2笔记》由会员分享,可在线阅读,更多相关《strucs2笔记(7页珍藏版)》请在金锄头文库上搜索。
1、strucs2strucs2 笔记笔记*流程*struts2org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterstruts2*.action/index.jsppublic class RegAction public String execute()return “ok“;*jsp 中通过$x.y-EL 调用属性*request-action 中的属性-session-public class UserAction extends ActionSupport private User user;publi
2、c User getUser() return user;public void setUser(User user) this.user = user;-登录名login:$user.login *建立 struts 项目;1、添加 jar 包2、web.xml 中添加过滤器3、struts.xml*struts 执行过程:*1. http:/loalhost:6688/second/a/b/reg.action?name=tom3、struts.xml:*redirectAction :重定向到一个 action chain: forward 到一个 action A-chain-B 俩a
3、ction,嵌套执行redirect: 重定向到一个 jspdispatcher: forward 到一个 jsp*显示提示消息:1、类 extends ActionSupportaddActionMessages();2、*保存消息:如何将 messa 存入 session:拦截器,paramAUTOMATIC*-radio 写法二:1、role 类2、设置属性private list(Role) rolelist=new Arraylist();添加静态块添加 getRolelist()方法3、-generic tagsui tags:form tags-non-form tagslabel-password-submit-checkbox-*小结:拦截器struts2 请求执行流程action 配置,请求路径。 。 。指定 namespace,action,form:theme=radio-list 写法action 与页面传输数据;get-在页面取出,set-页面的值读入