导航

2012年10月25日

摘要: dispatcher:服务器端跳转,地址栏不变redirect:客户端跳转,地址栏改变chain:可以跳转至Action(包括同namespace/package name 和 不同namespace的Action)。eg.<package name="public" extends="struts-default"> <!-- Chain creatAccount to login, using the default parameter --> <action name="createAccount" 阅读全文

posted @ 2012-10-25 10:32 阿里大盗 阅读(285) 评论(0) 推荐(0)

摘要: 方法:Action实现RequestAware,SessionAware等,属性Map, 并override相应方法(public void setSession)。eg.package com.bjsxt.struts2.user.action;import java.util.Map;import org.apache.struts2.interceptor.ApplicationAware;import org.apache.struts2.interceptor.RequestAware;import org.apache.struts2.interceptor.SessionAwar 阅读全文

posted @ 2012-10-25 10:04 阿里大盗 阅读(204) 评论(0) 推荐(0)

摘要: <action name="*_*" class="包名.{1}action" method="{2}"> <result>/{1}_{2}_success.jsp</result></action> 阅读全文

posted @ 2012-10-25 09:48 阿里大盗 阅读(104) 评论(0) 推荐(0)

摘要: 1.<action name="hgt" class=“com.sd.er.MyAction” >当Struts2找到需要的Action时,会自动创建MyAction类的对象,并执行其中的某个方法(public String xxx),获得返回值(默认“success”),根据 返回值调用相应得result。2.Action类需要继承ActionSupport,Action执行时默认调用execute(),但是可以method=""指定,或者DMI(动态方法调用:eg. <%=context%>/.../.../uesr!add 阅读全文

posted @ 2012-10-25 09:39 阿里大盗 阅读(130) 评论(0) 推荐(0)

摘要: 1.Browser发送http请求给Tomcat,Tomcat根据URL选择应用(webapp)。2.该webapp首先搜寻自己的web.xml中的filter(依据URL),然后确定是哪个filter需要被调用(这里是Struts2),于是调用Struts2的某个类的doFilter()。3.Struts2开始依据URL搜寻Struts.xml文件,根据namespace和action名来确定执行哪个Action。4.执行Action并依据返回值找到对应的result,执行result。 阅读全文

posted @ 2012-10-25 09:34 阿里大盗 阅读(136) 评论(0) 推荐(0)