一、配置web.xml中Struts2核心过滤器
<!-- Struts2核心过滤器 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
二、Web层Action类
public class HelloAction {
public String hello(){
System.out.println("hi,mark");
return "success";
}
}
三、struts.xml配置
<struts>
<package name="hello" namespace="/hello" extends="struts-default">
<action name="HelloAction" class="com.mark.test.HelloAction" method="hello">
<result name="success">/hello.jsp</result>
</action>
</package>
</struts>