首页 > 其他 > 详细

Struts2环境配置

时间:2014-05-02 22:46:25      阅读:521      评论:0      收藏:0      [点我收藏+]
1、导入jar包
bubuko.com,布布扣

2、拷贝修改配置文件struts.xml,web.xml
将struts.xml文件拷贝到src目录下,改为如下配置
<? 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.devMode" value= "true" />
    <!-- 把扩展名配置为action -->
    <constant name= "struts.action.extension" value = "action" />
    <!-- 把主题配置为simple -->
    <constant name= "struts.ui.theme" value= "simple" />
   
    <package name= "default" namespace ="/" extends= "struts-default">
       
    </package >

    <!-- Add packages here -->

</ struts>

将web.xml文件配置成如下形式
<? xml version= "1.0" encoding = "UTF-8"?>
< web-app version= "2.5" 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" >
        < display-name></ 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.jsp </welcome-file >
        </ welcome-file-list>
</ web-app>

ps:xml自动提示设置:
window ==> preferences ==> 搜索xml ==> xml catalog ==> key type改为URI ==> 选择dtd文件路径 ==>复制key为dtd文件名

Struts2环境配置,布布扣,bubuko.com

Struts2环境配置

原文:http://blog.csdn.net/ro_wsy/article/details/24832177

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!