官网下载Struts2.5-min-lib.zip解压把lib目录下jar包拷贝到web项目lib目录下
配置web.xml文件
<filter>
<filter-name>action2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- END SNIPPET: filter --> <filter-mapping>
<filter-name>action2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 注意2.3版本略有不同具体看官网指南 -->
struts.xml 新建在src目录下
<struts> <package name="helloword" extends="struts-default">
<action name="hello">
<result>/WEB-INF/pages/hello.jsp</result>
</action>
</package> </struts>
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body> <a href="hello.action">hello</a> </body>
</html>
运行项目跳转