property

value 的类型是  object
则<s:property value="username" />   -----------------------------------------------------------1

这里的username被当做ognl表达式
如果我们想要显示字符串只能这样写<s:property value="'username'" />
如果是ognl表达式,则上面1式中就会调用当前action中的getUserName的方法来获取username的值。
Set
The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. This is useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code readability improvement).
set标签主要是用来将一个复杂的表达式用一个简单的变量进行替换,以后只需读取这个变量就可以读取复杂表达式的值。
<s:set name="personName" value="person.name"/>Hello, <s:property value="#personName"/>. How are you?
这里将person.name在action context里面设定一个变量personName,之后我们通过property标签将这个值读取出来

The scopes available are as follows :-
  • application - the value will be set in application scope according to servlet spec. using the name as its key
  • session - the value will be set in session scope according to servlet spec. using the name as key
  • request - the value will be set in request scope according to servlet spec. using the name as key
  • page - the value will be set in page scope according to servlet sepc. using the name as key
  • action - the value will be set in the request scope and Struts' action context using the name as key

If no scope is specified, it will default to action scope.(request 和 ActionContext)

Include
<s:set var="incPage" value="%{'/_include1.html'}" />
<s:include value="%{#incPage}"></s:include>
include标签的value的类型是string,所以这里就会产生一个问题:如何在include里面使用ognl表达式,这里就引出了%的用法

struts tags 学习相关推荐

  1. struts tags logic

    struts tags logic <logic:empty/notEmpty/> <logic:empty name="bean" scope="sc ...

  2. struts tags bean

    struts tags bean 1.将以下三个常用struts tags 放到一个jsp页面下:     tags.jsp     <%@ taglib uri="http://st ...

  3. Struts tags详解(Data tags)

    **************************************************************************************************** ...

  4. Twig 的 tags学习(中文) 之一

    twig 的tags学习 之一 http://blog.csdn.net/jiaochangyun/article/details/7178372 twig 的tags学习 之二 http://blo ...

  5. Struts2 官方教程之Struts Tags(八)——UI Tags(Themes and Templates)

    UI标签是用来生成Web界面,或者为Web界面提供某些功能支持的标签,比如:表单标签就是把各种途径获取的需要展示的数据,通过动态生成HTML的形式展示到界面上. UI标签分成如下几种: Form Ta ...

  6. 基本STRUTS标签-学习笔记-Bean标签

    <bean:include> 和标准的JSP标签<jsp:include>很相似,都可以用来包含其他Web资源的内容,区别在于<bean:include>标签把其它 ...

  7. Struts入门学习(三)---自定义类型转换器

    类型转换器是将浏览器传递的参数进行转换为了与服务器端的参数匹配,先举个例子如果我们想往服务器传递日期类型的参数时我们要怎么让浏览器传过去的让服务器明白 我们新建一个类 ConverterTest.ja ...

  8. Struts2 官方教程之Struts Tags(六)——Generic Tags(Control Tags )

    开头要说的:在早期的应用开发中,表现层Jsp页面主要使用Jsp脚本来控制输出.这样,在Jsp中嵌套了java脚本,这种方式不管是可读性还是可维护性都很差,几乎使Jsp成为Java的子集.从Jsp1.1 ...

  9. 从struts2回到struts的学习--DynaActionForm(不用手写actionForm.java)

    使用DynaActionForm 2006年12月05日 星期二 下午 01:26 一个网站中会有许多的表单以供使用者填写资料,越大型的网站越需要更多的 ActionForm 物件来应付表单的取值,对 ...

最新文章

  1. ModelCheckpoint 讲解【TensorFlow2入门手册】
  2. 設計模式之王 - MVC
  3. Excel 中使用数据透视表 Pivot Table
  4. 对01背包的分析与理解(图文)
  5. LeetCode 551. 学生出勤记录 I
  6. HDU 3695 Computer Virus on Planet Pandora (AC自己主动机)
  7. 星环inceptor建表公式以及各个表的区别联系
  8. 用python祝节日快乐_节日快乐祝福语有哪些?
  9. java 发微信视频_分享java微信开发视频
  10. laravel 验证手机号
  11. 阿里巴巴全球化测试技术介绍
  12. 面经-【兴业证券】【京东】【网易】
  13. POI读取Excel 各种特殊数字和类型的转换
  14. MySQL获取季初日期_用于取得当前日期相对应的月初,月末,季初,季末,年初,年末时间...
  15. flv.js php,flv.js的使用详解
  16. 创建一个整型变量toes,并将toes设置为10.
  17. 软件工程与计算II-20-软件交付
  18. org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Invalid OpProcessor requested [Req
  19. 如何刻录VCD防盗光盘
  20. Java阻塞队列-BlockingQueue介绍及实现原理

热门文章

  1. 《机器学习》周志华-CH1 绪论
  2. python如何将图片的像素矩阵绘制成图片(python,matplotlib):TypeError: Invalid shape (1, 28, 28) for image data
  3. 温故而知新,6位顶级CV科学家聚首:计算机视觉中的深度学习方法vs传统方法...
  4. 三大运营商扎堆进军“元宇宙”
  5. 主宰这个世界的10大算法
  6. 人脑启发AI设计:让神经网络统一翻译语音和文本
  7. 只有这种AI芯片才能拯救人工智能?
  8. 人工智能写出第一篇文章:我真的没想要消灭你们,人类!
  9. MEMS惯性传感器有哪些趋势?
  10. 2018-2019年新一代AI领域十大最具成长性技术展望