zoukankan      html  css  js  c++  java
  • Struts2_HelloWorld_2

    设置 tomcat 的位置 (jre:并不是jdk)

    打开 struts2目录:
    apps 示例程序
    docs 文档
    lib 类库
    src 源码

    打开 apps 目录下的 struts2-blank.war 项目
    1、拷贝 struts2-blankWEB-INFclasses 文件夹下的 strut2.xml 文件到 src 目录下;
    2、拷贝 struts2-blankWEB-INFlib 下的所有 jar 包到lib目录下,导入项目;


      tip:切换 navigator 可以看所在项目的所有文件
    3、对于web.xml 的配置

    拷贝 struts2-blankWEB-INFweb.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>

    当前项目版本是 struts-2.3.16.1,所有配置的filter是 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。

    StrutsPrepareAndExecuteFilter 2.1 以后,DispatcherFilter 是 2.0。这些都参考示例空白项目的配置。

    这样空白的项目就建好了。

    代码链接:http://pan.baidu.com/s/1kV4uTBx 提取码:5mjj

  • 相关阅读:
    Educational Codeforces Round 86 (Rated for Div. 2) D. Multiple Testcases
    Educational Codeforces Round 86 (Rated for Div. 2) C. Yet Another Counting Problem
    HDU
    HDU
    HDU
    HDU
    Good Bye 2019 C. Make Good (异或的使用)
    Educational Codeforces Round 78 (Rated for Div. 2) C. Berry Jam
    codeforces 909C. Python Indentation
    codeforces1054 C. Candies Distribution
  • 原文地址:https://www.cnblogs.com/ShawnYang/p/6668306.html
Copyright © 2011-2022 走看看