Struts2_HelloWorld_2
設(shè)置 tomcat 的位置 (jre:并不是jdk)
打開 struts2目錄:
apps 示例程序
docs 文檔
lib 類庫
src 源碼
打開 apps 目錄下的?struts2-blank.war 項(xiàng)目
1、拷貝 struts2-blank\WEB-INF\classes 文件夾下的?strut2.xml 文件到 src 目錄下;
2、拷貝 struts2-blank\WEB-INF\lib 下的所有?jar 包到lib目錄下,導(dǎo)入項(xiàng)目;
tip:切換 navigator 可以看所在項(xiàng)目的所有文件
3、對于web.xml 的配置
拷貝 struts2-blank\WEB-INF\web.xml的配置?
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> 3 <display-name>Struts2_0100_Introduction</display-name> 4 5 <filter> 6 <filter-name>struts2</filter-name> 7 <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 8 </filter> 9 10 <filter-mapping> 11 <filter-name>struts2</filter-name> 12 <url-pattern>/*</url-pattern> 13 </filter-mapping> 14 15 <welcome-file-list> 16 <welcome-file>index.jsp</welcome-file> 17 </welcome-file-list> 18 </web-app>當(dāng)前項(xiàng)目版本是?struts-2.3.16.1,所有配置的filter是?org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。
StrutsPrepareAndExecuteFilter 2.1 以后,DispatcherFilter 是 2.0。這些都參考示例空白項(xiàng)目的配置。
這樣空白的項(xiàng)目就建好了。
代碼鏈接:http://pan.baidu.com/s/1kV4uTBx 提取碼:5mjj
轉(zhuǎn)載于:https://www.cnblogs.com/ShawnYang/p/6668306.html
總結(jié)
以上是生活随笔為你收集整理的Struts2_HelloWorld_2的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: AutoMapper之投影
- 下一篇: Cisco配置单臂路由及静态路由