struts2创建步骤
- 安装struts2 在web.xml 中配置<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher(以前版本现在已过时,启动tomcat会提示)现在使用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> - 编写action类 public class MyAction extends ActionSupport
- 配置action类 <struts>
<package name="struts2" namespace="/mystruts" extends="struts-default">
<action name="sum" class="com.action.MyAction">
<result name="positive">/positive.jsp</result>
<result name="nagetive">/nagetive.jsp</result>
</action>
</package>
</struts> - 编写jsp入口