struts2环境搭建

来源:互联网 发布:数学不好能学编程吗 编辑:程序博客网 时间:2024/05/16 07:54

1、所需jar包

                  

                  (小技巧:从Struts2发行包\apps\struts2-blank\WEB-INF\lib拷贝)

2、配置web.xml

<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">    <display-name>Struts Blank</display-name>    <filter>        <filter-name>struts2</filter-name>        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>    </filter>    <filter-mapping>        <filter-name>struts2</filter-name>        <url-pattern>/*</url-pattern>    </filter-mapping>    <welcome-file-list>        <welcome-file>index.html</welcome-file>    </welcome-file-list></web-app>

3、核心配置文件struts.xml

  at the top of the classpath ,建立一个名称为struts.xml的配置文件

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><struts>  </struts>         <span style="font-family:宋体;"></span>

            (小技巧:从Struts2发行包\apps\struts2-blank\WEB-INF\classes\struts.xml拷贝)

4、验证:

               部署到Tomcat中,启动,如果没有任何错误,环境搭建是非常成功的


0 0
原创粉丝点击