zoukankan      html  css  js  c++  java
  • Struts2环境配置

    1、导入jar包


    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文件名称
  • 相关阅读:
    CI登录验证
    兼容所有浏览器的JS动态显示当前日期时间
    Active Record 数据库模式-增删改查操作
    数据库链接的增操作举例
    CI框架获取post和get参数 CodeIgniter
    PHP日期操作类代码-农历-阳历转换、闰年、计算天数等
    根据两点间的经纬度计算距离
    Session 类
    mysql 查询优化规则
    php获取文件夹下面的文件列表和文件夹列表
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/6748159.html
Copyright © 2011-2022 走看看