博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaWeb——配置Struts2
阅读量:3935 次
发布时间:2019-05-23

本文共 954 字,大约阅读时间需要 3 分钟。

JavaWeb——Struts2

三、Struts2 的配置

  • Struts2 这个框架在使用之前必须进行相关的配置,一般在 .xml 文件中进行配置。Struts2 中配置文件主要有:
  • struts-default.xml,struts-plugin.xml,struts.xml,struts.properties 和 web.xml
  • struts-default.xml,struts-plugin.xml 这两个配置文件位于 Struts2 包中;struts.xml 为 Web 应用中 Struts2 的默认配置文件,struts.properties 文件是 Struts2 的属性配置文件,后两个文件由开发者编写,前两个由框架提供。

1、Struts.xml 的 <package>

  • <package> 元素用于进行 Struts2 的包配置,Struts2 通过使用包这个逻辑单元,提高了代码的可重用性,该元素的相关属性如下表:
    属性名 作用
    name 包名称,便于使用此包,为必须属性
    extends 指明继承的包
    namespace 指定名称空间,即访问此包下的 Action 需要访问的路径
    abstract 将包声明为抽象类型,即包内不定义任何 Action
  • <package> 声明示例如下:
    ......

2、Struts.xml 的 <action>

  • <action> 元素标签位于 <package> 标签体内,用于建立 Action 对象的映射:指定 Action 的请求地址及处理后的映射页面。<action> 元素标签的属性如下:
    属性名 作用
    name 用于配置 Action 对象被请求的 URL 映射
    class 指定 Action 对象的类名
    method 设置请求 Action 对象时,调用 Action 的哪一个方法
    converter 指定 Action 对象类型转换器的类
  • 示例:
    /StrutsJSP/stu_add.jsp
    /StrutsJSP/stu_update.jsp

转载地址:http://doqgn.baihongyu.com/

你可能感兴趣的文章
3.6 - Maya Commands: setAttr
查看>>
3.7.1 - Strings
查看>>
3.7.4 - Indexing and Slicing Strings
查看>>
3.7.5 - Modifying Strings
查看>>
3.7.6 - String Methods
查看>>
3.8 - Using the Print Function
查看>>
3.9.1 - Lists in Python
查看>>
3.9.2 - Lists - Adding and Removing Objects
查看>>
3.9.3 - Sorting Lists
查看>>
3.10 - Maya Commands: ls
查看>>
3.11 - Dictionaries in Python
查看>>
3.12 - Tuples in Python
查看>>
4.4 - For Loops
查看>>
4.2.2 - Logical and/or Operators
查看>>
Lesson 4 Part 2 Softmax Regression
查看>>
文章中运用到的数学公式
查看>>
Projective Dynamics: Fusing Constraint Projections for Fast Simulation
查看>>
从2D恢复出3D的数据
查看>>
glm 中 数据类型 与 原始数据(c++ 数组)之间的转换
查看>>
Derivatives of scalars, vector functions and matrices
查看>>