在struts2中用到了struts框架
我的体会是在index.jsp中,当我点击提交,它就会响应index.action,这个index.action
在我们整个项目中并不是一个控制器,我们应该这样看,它根据index在struts.xml中找到
action/UserAction这个类,在struts.xml中还有2个结论就是对它的成功和失败后的处理
<result name="success" type="redirect">/successs.jsp</result>
<result name="input">/index.jsp</result>
在UserAction类中就有execute()方法,它就是给出结果,然后返回到struts.xml中对结果进
行相应的处理。而action呢,这个存在于web.xml,它就像是一个过滤器一样,过滤掉整个项
目的所有action, <filter-name>action</filter-name>
<url-pattern>*.action</url-pattern>
根据这个做出相应的处理,知道你是什么样的action做出相应的处理。
我的体会是在index.jsp中,当我点击提交,它就会响应index.action,这个index.action
在我们整个项目中并不是一个控制器,我们应该这样看,它根据index在struts.xml中找到
action/UserAction这个类,在struts.xml中还有2个结论就是对它的成功和失败后的处理
<result name="success" type="redirect">/successs.jsp</result>
<result name="input">/index.jsp</result>
在UserAction类中就有execute()方法,它就是给出结果,然后返回到struts.xml中对结果进
行相应的处理。而action呢,这个存在于web.xml,它就像是一个过滤器一样,过滤掉整个项
目的所有action, <filter-name>action</filter-name>
<url-pattern>*.action</url-pattern>
根据这个做出相应的处理,知道你是什么样的action做出相应的处理。