Struts.xml配置详解
来源:互联网 发布:木地板推荐 知乎 编辑:程序博客网 时间:2024/05/29 19:29
<?xml version="1.0" encoding="UTF-8"?> 文档为xml格式 字符编码为UTF-8
<!DOCTYPE struts PUBLIC (DOCTYPE是文档类型标签)根节点struts
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" 公共标识符 "注册//组织//类型 标签//定义 语言"
"http://struts.apache.org/dtds/struts-2.3.dtd"> 文档类型定义位置
<struts> 根节点
<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant> 配置属性 详情见constant节点介绍
<constant name="struts.devMode" value="true"></constant>
<package name="default" extends="struts-default"> name属性为每个package的唯一标识,extends可以指定本package继承另外一个package的所有配置
<default-action-ref name="index"></default-action-ref> 当没有对应的action时,默认执行的action (name属性的值)
<global-results> 当没有对应的result 默认的result
<result name="error">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"></exception-mapping>
</global-exception-mappings>
global-exception-mappings用于异常处理的标签可以配置在Action中,也可以配置在<global-exception-mappings>,顾名思义就是全局异常,当然执行Action的时候发生异常时,如果在Action中没有捕获异常而是抛出异常的话,struts2会首先在正在执行的Action中查找<exception-mapping>,寻找对应的Exception进行处理,如果找不到,才会去<global-exception-mappings>去寻找对应的Exception处理,如果还是找不到的话,就只好抛出异常了。上面是捕获java.lang.Exception异常 返回error result
<action name="Login" class="action.LoginAction" method="login"> 定义action 以及执行的类和方法
<result>/loginResult.jsp</result>
<result name="input">/login.jsp</result>
</action>
</package>
</struts>
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- Struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- Struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- struts.xml配置详解
- Android SDK开发包国内下载地址
- 开源软件架构:Nginx
- 触摸绘图
- 遇到的小问题
- 写外挂的时候遇到有的用户用挂注入不了游戏~
- Struts.xml配置详解
- Java实现数据排序(冒泡、选择、插入、快速排序)---方法持续更新中
- 数据结构和算法设计专题之---24点游戏(穷举法和递归法)
- POJ2362 Square
- 【大话QT之十五】ctkPluginFrameWork插件系统Windows下编译
- 对扩展openflow协议的一点思考
- PAT:2-1. 厘米换算英尺英寸(15)
- 字符串KMP模式匹配算法
- hdu 1166 敌兵布阵