配置服务器

1、web.xml过滤器

1    <filter>
2   <filter-name>struts2</filter-name>
3   <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
4     </filter>
5   
6   <filter-mapping>
7   <filter-name>struts2</filter-name>
8   <url-pattern>/*</url-pattern>
9   </filter-mapping>

2、struts.xml

从E:\struts-2.5.20\apps\struts2-rest-showcase\WEB-INF\classes中复制到src文件夹下,删除不需要的内容

 1 <?xml version="1.0" encoding="UTF-8" ?>
 2 
 3 <!DOCTYPE struts PUBLIC
 4         "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
 5         "http://struts.apache.org/dtds/struts-2.5.dtd">
 6 
 7 
 8 <struts>
 9 <package name="demo" extends="struts-default" namespace="/">
10 <!-- <action name="login" class="com.hhh.Basic" method="login"></action>
11 <action name="postString" class="com.hhh.Basic" method="postString"></action> -->
12 
13 </package>
14  
15 </struts>/struts>
posted @ 2019-07-19 14:26  丹小丹  阅读(89)  评论(0编辑  收藏  举报