Struts的配置文件

Struts的核心配置文件是struts.xml,Struts应用的的各组件及其关系均在该文件中声明

struts.xml配置文件基本结构:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC
 "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
 "http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>
<!--Bean配置-->

<bean name="Bean的名字" class=“自定义的组件类”/>

<!--常量配置-->

<constant name="属性名" value="属性值"/>

<!--导入配置文件-->

<include file="文件名"/>

<!--包配置-->

<package name="包名称" namespace="/包的命名空间名" extends="structs-default">

<!--对Action的配置,可以有多对-->

  <action name="名称" class="Action对应的类" method="Action中某方法名">

    <!--定义逻辑视图和物理资源之间的映射-->

    <result name="success">/page/hello.jsp</result>

  </action>
</struts>  

原文地址:https://www.cnblogs.com/lls1350767625/p/7816882.html