struts2应用02
来源:互联网 发布:原油数据影响大吗 编辑:程序博客网 时间:2024/06/05 15:07
上节我们完成简单的配置,了解了struts2框架工作流程,本节我们介绍一些action中元素,拦截器等
1.在struts之间引入<constant name="struts.devMode" value="true" />
可以打印出更详细的错误信息,改这个文件中的配置就不用去重启tomcat,把它设置为开发模式,发布时要设置为false
2.<constant name="struts.ui.theme" value="simple" />
不希望struts2模板内容对你的开发有影响
3.<constant name="struts.multipart.maxSize" value="10000000"/>
文件上传大小,10M4.package元素
struts在设计时就考虑到了模块问题,所以把各个动作组织成不同的包。一个典型的struts.xml文件可以有一个或者多个包。
5.拦截器相关元素
必须现在<interceptors>中定义子元素<interceptor>注册一个或多个拦截器,interceptor-stack用于将定义拦截器分组,name自定义,如果动作标签没有指定任何拦截器,则会使用默认default-interceptor-ref该标签指定的拦截器或者拦截器组
<interceptors><interceptor name="loginInterceptor" class="com.tangjiu.detail.tools.interceptor.LoginInterceptor"/>
<interceptor name="authInterceptor" class="com.tangjiu.detail.tools.interceptor.AuthInterceptor"/>
<interceptor name="exceptionInterceptor" class="com.tangjiu.detail.tools.interceptor.ExceptionInterceptor"/>
<interceptor-stack name="invoceInterceptor">
<interceptor-ref name="exceptionInterceptor"/><interceptor-ref name="loginInterceptor"/>
<interceptor-ref name="authInterceptor"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="invoceInterceptor"></default-interceptor-ref>
6.result元素
<result>元素是<action>的一个子元素它告诉struts你想在动作把权交到哪里
7.<global-results>
一个action可以包含一个<global-results>元素,定义结果是一些通用的结果,如果某个动作在它声明的动作里找不到对应指令,就会搜索该元素中定义结果。
8.通配符映射
“*”为struts2中通配符
例如<action name="emp_*" class="empAction" method="{1}">
emp_login,emp_list等都会匹配到,并到empAction中找到对应login,list等方法
- struts2应用02
- 02_第一个Struts2应用
- Struts2.0的应用
- struts2.0应用
- Struts2应用中的国际化
- struts2应用总结
- mysql struts2 应用
- struts2+ajax的应用
- Struts2应用分析
- Struts2应用的配置文件
- struts2中的注解应用
- Struts2标签高级应用
- 初次应用Struts2 心得
- Struts2 的基本应用
- 手动建立Struts2应用
- Struts2 jquery autocomplete应用
- 第一个Struts2应用
- Struts2应用开发步骤
- HDU 1506 DNA sequence IDA*
- 数据库三大范式(第一范式,第二范式,第三范式)
- 【noip2011D2T1】计算系数(数论)
- 二分搜索
- Glide 一个专注于平滑滚动的图片加载和缓存库
- struts2应用02
- python 字符串翻转| 单词翻转
- 学习下oracle的存储过程增删改查操作以及java调用存储过程
- 数据泵+DBLINK迁移用户
- matlab中处理图像如何加快处理速度?
- HDU1423&POJ2127-Greatest Common Increasing Subsequence
- FCC--Spinal Tap Case(单词连接)
- phpcms导航栏调用二级栏目的标签。
- wpf制作分页控件