1 .eclipse中新建项目

后边自己设置,然后完成

2.在pom.xml添加

<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>3.0-alpha-1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        
         <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-core</artifactId>
          <version>2.3.24</version>
        </dependency>

会看到

3.在web-inf中配置struts2

如下配置

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "
        version="2.5">
    <display-name>sign</display-name>
    
    <filter>    
        <filter-name>struts</filter-name>    
        <filter-class>
            org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter    
        </filter-class>    
        <init-param>    
            <param-name>struts.i18n.encoding</param-name>    
            <param-value>utf-8</param-value>    
        </init-param>    
    </filter>
    
    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <error-page>
        <error-code>404</error-code>
        <location>/common/404.html</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/common/500.html</location>
    </error-page>
    
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

4.添加对应处理页面

5.配置用maven方式启动tomcat,pom.xml中

<build>
    <finalName>signn</finalName>
     <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat6-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <url>http://localhost/manager</url>
                    <path>/sign</path>
                    <port>8010</port>
                    <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warSourceDirectory>src\main\webapp</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>7</source>
                    <target>7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.2</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>target</directory>
                            <includes>
                                <include>signn</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
  </build>

6.添加配置文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <!--     
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.objectFactory.spring.autoWire" value="name" />
    -->
    <constant name="struts.i18n.encodeing" value="GBK"/>
    <constant name="struts.multipart.maxSize" value="52428800" />
    
    <!-- <include file="struts/struts-common.xml"/> -->
    <package name="user"  namespace="/" extends="struts-default">
        <action name="user" class="com.sign.action.UserAction" method="toUser">
            <result name="SUCCESS">/view/user.jsp</result>
        </action>
    </package>
</struts>

7.写对应的action

7.启动tomcat

8.在浏览器中访问

javaEE_maven_struts2_tomcat_first的更多相关文章

  1. spring4+hibernate4+struts2环境搭建

    tomact配置请查看下面的文章 javaEE_maven_struts2_tomcat_first http://www.cnblogs.com/luotuoke/p/4543686.html po ...

随机推荐

  1. Python之Django的Model2

    一.创建数据库 创建数据库 进入数据库: mysql -uroot -p 创建数据库: CREATE DATABASE test1 CHARSET=utf8; 连接数据库 虚拟环境中安装数据库模块:p ...

  2. 洛谷 P2813 母舰

    题目描述 在小A的星际大战游戏中,一艘强力的母舰往往决定了一场战争的胜负.一艘母舰的攻击力是普通的MA(Mobile Armor)无法比较的. 对于一艘母舰而言,它是由若干个攻击系统和若干个防御系统组 ...

  3. php学习随记3

    <? php #正則表達式 #就是一种描写叙述字符串结构的语法规则 #是一个特定的格式化模式 #1. 行定位符 /* 1) ^行首 2)$行尾 tm eqaul Tomorrow Moon ^t ...

  4. sql系列(基础篇)-前言 课前补充知识

    前言 课前补充知识 Number(p,s) Number(p,s):数字类型,p 表示数字的有效长度(从数字的左边第 1 位不为 0 的開始算起,直到最右边的长度.取值范围 0~38 位),s 表示数 ...

  5. 深入解析Dropout——基本思想:以概率P舍弃部分神经元,其它神经元以概率q=1-p被保留,舍去的神经元的输出都被设置为零

    深度学习网络大杀器之Dropout——深入解析Dropout  转自:https://yq.aliyun.com/articles/68901 摘要: 本文详细介绍了深度学习中dropout技巧的思想 ...

  6. [SPOJ 30669] Ada and Trip

    [题目链接] https://www.spoj.com/problems/ADATRIP/ [算法] 直接使用dijkstra堆优化算法即可 [代码] #include<bits/stdc++. ...

  7. encodeURIComponent编码java后台解码出现乱码问题

    问题:JavaScript请求后台带着name参数,有中文进行编码:url?name=" + encodeURIComponent(name):java后台直接使用name或者name=ja ...

  8. wamp服务器下安装mantis

    什么是Mantis Mantis是一个BUG管理系统.主要特点如下: 1.用php写的系统,安装方便,不用像 bugzilla 那样安装那么多perl支持: 2.系统相对简单轻磅,使用简单: 3.出色 ...

  9. Polyfill 与 Shim

    Polyfill 与 Shim polyfill 的概念是 Remy Sharp 在2010年提出的. polyfill,或 polyfiller ,表示为开发人员提供旧浏览器没有原生支持的较新功能的 ...

  10. Keras简单使用

    Keras简单使用在keras中建立模型测试自己的图片一些有用的函数(持续更新) Keras简单使用 在keras中建立模型 相对于自己写机器学习相关的函数,keras更能快速搭建模型,流程如下: 通 ...