<package name="mypackage" extends="struts-default">
<global-results>
<result name="error">/success.jsp</result>
</global-results>

其它包 extends="mypackage" 就可以用到它里面的参数了

常量

     <constant name="struts.devMode" value="true"></constant>
<constant name="struts.i18n.encoding" value="UTF-8"></constant><!-- 相当于HttpServletRequest.setCharacterEncoding("UTF-8") -->
<constant name="struts.action.extension" value="action,,do"></constant><!-- Struts2框架实际要处理的后缀 -->
<constant name="struts.serve.static.browserCache" value="false"></constant><!-- 静态资源是否需要缓存,开发阶段最好改成false -->
<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant><!--禁用动态方法调用 -->
<constant name="struts.multipart.maxSize" value="52428800"></constant>      <!-- 限制文件大小-->

struts2中每个请求都局部创建一个变量执行的,所以是线程安全的

<include file=""></include>导入其他文件的 配置,为了解决action配置太多 看的花

struts.xml中关闭动态调用 ,!后面就是动态调用

//(不建议使用)动态方法调用:http://localhost:8080/struts2day02/customer/addCustomer!updateCustomer(应该执行addCustomer,使用!updateCustomer,在请求addCustomer就执行了updateCustomer)
//关闭动态调用的功能:struts.enable.DynamicMethodInvocation = false

<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>

{1}代表前面的*

         <action name="orders_*" class="cn.itcast.action.OrdersAction" method="{1}">
<result type="dispatcher" name="success">/orders/{1}.jsp</result>
<result type="dispatcher" name="input">/orders/{1}.jsp</result>
</action>
<!--
当访问http://localhost:8080/struts2day02/orders/orders_add动作时,就去调用add方法,并且转向add.jsp页面。因为使用了通配符。
-->

struts 会根据 变量是否存在,如果不存在会创建一个实例变量 并且赋值。例如

public class Customer

{

  String id;

Address  a;

set()get()省略

}

框架会new出 Address并且赋值

jsp中 <input type="radio" name="hobby" value="吃饭">

jsp中 <input type="radio" name="hobby" value="睡觉">

类设计中class

String[]hobby;

ActionContext.getContext() 可以用于获取Action上下文

Struts2中的变量的更多相关文章

  1. jap页面获取struts2中action中变量的值

    在jsp页面中可以通过ONGL表达式获取struts2中action处理后的变量的值,这是因为每一个action在初始化后都会放到strackcontext中,可以通过ONGL表达式取到值. 注意要在 ...

  2. struts2 中 Actionsupport 的作用

    struts2 中 Actionsupport 的作用 Action 跟 Actionsupport 的区别     当我们在写action的时候,可以实现Action接口,也可以继承Actionsu ...

  3. Struts2中的ActionContext、OGNL及EL的使用

    文章分类:Java编程 本文基于struts2.1.8.1,xwork2.1.6 1.EL         EL(Expression Language)源于jsp页面标签jstl,后来被jsp2.0 ...

  4. struts2中各种值栈问题

    struts2中OGNL和 ValueStack(一) 收藏 学习的时候,总分不清楚在struts2中页面的传值和取值是怎么来完成的,所以从网上搜了很多资料,现在把这些资料总结写,留着以后参考..看完 ...

  5. 【转】Struts2中的MethodFilterInterceptor(转)

    这是一个Struts2.1.8.1应用,代码如下 首先是web.xml文件 view plaincopy to clipboardprint?01.<?xml version="1.0 ...

  6. 在Struts2中使用ValueStack、ActionContext、ServletContext、request、session等 .

    笔者不知道该用哪个词来形容ValueStack.ActionContext等可以在Struts2中用来存放数据的类.这些类使用的范围不同,得到的方法也不同,下面就来一一介绍. 声明:本文参考Strut ...

  7. Struts2中的校验框架

    Struts2提供的客户端校验 尽管这种支持比较弱,但采用Struts2中的客户端校验时需要注意以下几点 1..将<s:form validate="true">的va ...

  8. struts2中 ServletActionContext与ActionContext区别

    1. ActionContext 在Struts2开发中,除了将请求参数自动设置到Action的字段中,我们往往也需要在Action里直接获取请求(Request)或会话(Session)的一些信息, ...

  9. struts2中#,$,%的用法以及el,ognl表达式的用法

    OGNL, JSTL, STRUTS2标签中符号#,$,%的用法示例 取Session中的值 <c:out value="${sessionScope.user.userId}&quo ...

随机推荐

  1. [NOIP2015] D1T2 信息传递

    洛谷题目链接:https://www.luogu.org/problemnew/show/2661 一道有很多种解法的题目 通过划归,发现就是求最小环 那么立即能想到的算法:1.Tarjan求强连通分 ...

  2. 【BFS】POJ3669-Meteor Shower

    [思路] 预处理时先将陨石落到各点的最短时间纪录到数组中,然后在时间允许的范围内进行广搜.一旦到某点永远不会砸到,退出广搜. #include<iostream> #include< ...

  3. kubernetes HA 脚本

    集群方案: 发行版:CentOS 7 版本: Kubernetes:1.9.1 master高可用方案:keepalived LVS 网络方案:Flannel Master HA 四步骤: 1. 安装 ...

  4. 【web 回车】web项目 注册或登录页面 回车登录无效,解决方案

    解决方案: /** * 登陆按钮的点击事件 */ $("#loginID").click(function(){ var username = $("#u"). ...

  5. JQUERY中的事件处理:RETURN FALSE、阻止默认行为、阻止冒泡以及兼容性问题

    return false 在jQuery中,我们常用return false来阻止浏览器的默认行为,那"return false"到底做了什么? 当你每次调用"retur ...

  6. jquery dialog close icon missing 关闭图片丢失,样式丢失问题

    http://stackoverflow.com/questions/17367736/jquery-ui-dialog-missing-close-icon

  7. iOS:LKDBHelper实体对象映射数据库-第三方框架(在FMDB的基础上进行二次封装)

    一 插件简介: 其github地址:https://github.com/li6185377/LKDBHelper-SQLite-ORM 全面支持 NSArray,NSDictionary, Mode ...

  8. KISS

    哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 ...

  9. Android studio 和 Eclipse快捷键对比

    操作 studio eclipse   debug/run 计算变量值 alt+F8 ctrl+shift+I 跳到下一步 F8 F6 跳到下一个断点 shift+F8 F8 进入到代码 F7 F5 ...

  10. 分析apache日志,统计ip访问频次命令

    统计访问频次最高的10个ip: cat /var/log/httpd/access_log |awk '{print $1}'|sort|uniq -c|sort -nr|head -10 统计恶意i ...