zoukankan      html  css  js  c++  java
  • OA学习笔记-002-Sruts2.1配置

    一、jar

    commons-fileupload-1.2.1.jar
    commons-io-1.3.2.jar
    freemarker-2.3.15.jar
    ognl-2.7.3.jar
    struts2-core-2.1.8.1.jar
    xwork-core-2.1.6.jar

    二、配置文件

    1.struts.xml

     1 <?xml version="1.0" encoding="UTF-8" ?>
     2 <!DOCTYPE struts PUBLIC
     3     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
     4     "http://struts.apache.org/dtds/struts-2.0.dtd">
     5 
     6 <struts>
     7     <!-- 配置为开发模式 -->
     8     <constant name="struts.devMode" value="true" />
     9     <!-- 把扩展名配置为action -->
    10     <constant name="struts.action.extension" value="action" />
    11     <!-- 把主题配置为simple -->
    12     <constant name="struts.ui.theme" value="simple" />
    13     
    14    
    15     <package name="default" namespace="/" extends="struts-default">
    16       
    17         <!-- 配置测试用的Action,未与Spring整合,class属性写类的全名 -->
    18         <!-- 当Struts2与Spring整合后,class属性可以写bean的名称 -->
    19         <action name="test" class="testAction">
    20             <result name="success">/test.jsp</result>
    21         </action>
    22 
    23 
    24     </package>
    25 
    26     <!-- Add packages here -->
    27 
    28 </struts>

    2.web.xml

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <web-app version="3.0" 
     3     xmlns="http://java.sun.com/xml/ns/javaee" 
     4     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     5     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
     6     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
     7   <display-name></display-name>    
     8   <welcome-file-list>
     9     <welcome-file>index.jsp</welcome-file>
    10   </welcome-file-list>
    11 
    12     <!-- 配置Struts2的核心的过滤器 -->
    13     <filter>
    14         <filter-name>struts2</filter-name>
    15         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    16     </filter>
    17     <filter-mapping>
    18         <filter-name>struts2</filter-name>
    19         <url-pattern>/*</url-pattern>
    20     </filter-mapping>
    21 </web-app>

     

  • 相关阅读:
    WebFrom与MVC异同
    MVC解决WebFrom的缺点
    转载ORM--EF框架
    转载 HashSet用法 合交并差
    用户管理模块数据库设计
    外键的增删改查练习
    索引:如何让主键不自动创建聚集索引???
    SQL-类型转换函数
    SQL-union
    SQL字符串函数
  • 原文地址:https://www.cnblogs.com/shamgod/p/5225059.html
Copyright © 2011-2022 走看看