J2EE学习笔记(3) Struts Logic Tags
Logic Tags语法应用是 --
<someComparisonTag value="someUserNameValue" cookie="userName"> (cookie specifies the name of the cookie to compare with value)
<someComparisonTag value="en_US" header="Accept-Language"> (header specifies the name of the HTTP header to compare with value)
<someComparisonTag value="someUserNameValue" parameter="username"> (parameter specifies the name of the request parameter to compare with value)
<someComparisonTag name="testBean" property="propNameInTestBean" value="someValue"> (典型)
name指定了bean的名字而property指定了该bean的某个property以便于与value比较, 通常我们还可以加一个scope来限制bean
property is used in conjunction with name to specify a property in the bean specified by name. The property reference can be simple, nested, and/or indexed. For the type of syntax used for property, see the users guide on the Bean Tags.
scope specifies the bean scope which can be page, request, session, application, "any scope" (default)
1) 值比较 Value Comparison: equal, notEqual, greaterEqual, lessEqual, lessThan, greaterThan
比较逻辑是 -- 先试图convert成long double,并比较; 如果parse失败就会用String.equalTo()来比较
1) 值比较 Value Comparison: present, notPresent, empty, notEmpty
present看的是某变量/实例是否存在于某个限定范围,empty看的是该实例是否为null, "", or collection.isEmpty()==true (only for collection)
2) 子字符串匹配 Substring Matching: match, notMatch
match/notMatch 还有一个可选location来指定该substring必须出现在字符串开始还是结尾 (location="start/end")
3) Presentation Location: forward, redirect
用法尚不清楚
4) Collection Utilities: iterate (极常用)
<logic:iterate id="searchResultList" name="<%=WebKeys.SEARCH_RESULT_LIST_TWO%>" scope="session">
<bean:write name="searchResultList" property="itemName"/></a>
<bean:write name="searchResultList" property="itemUnitOfMeasure" />
<bean:write name="searchResultList" property="inventoryDetailSize" format="#0.00"/>
</logic:iterate>
如果property给定,name代表了一个bean的实例,而这个bean的getThatProperty()将返回此tag需要的collection实例,
如果没有给定property, name本身就指定了将被iterate的collection的实例,
id给出了每一次循环的collection的当前object的名字,用于在内部使用
offset和length指定了从collection的哪个位置开始,到哪里结束,其他请参见Struts Documentation,这里不详述
↓相关文章:
- · J2EE学习笔记(2) javascript 讨论
- · J2EE之类的概念
- · Charset in J2EE Web Application
- · EJB技术及应用
- · J2EE应用部署(三):高级篇
- · 了解Struts1.1介绍
- · 漫谈EJB (2)
- · PASX简化Java开发
- · io的学习
- · 使用mod_jk2.so整合Apache2.049与Tomcat5.019
- · J2SE 1.5 in a Nutshell 中文版
- · Apache 使用基础(建议初学者仔细看看)
- · Resin和iis配置多个站点
- · 用J2EE开发WebService
- · Resin和iis配置多个站点
- · Apache Tomcat 重要信息暴露漏洞
- · 安装好你的机器来使用JSP(转)
- · 在Windows上安装Tomcat
- · 在Linux上安装Tomcat
- · <试验>win2k在apache1.3上配置tomcat3.1
- · 在windows2000 server中文版上安装apache <原创>
- · EJB概述(上)
- · WebSphere快速入门(15)
- · EJB内部资参1
- · EJB内部资参3
- · JRun常见问题回答 (JRun 中文 FAQ)
- · 真正的apache,tomcat,mod_jk安装指南 原创
- · java bean 与 ejb的区别
- · 将 Microsoft 的 Internet Information Server 用作 Java servlet 引擎 一 (给学过ASP的朋友)
- · j2ee doc 翻译系列之二
- · j2ee的jdbc配置指南(二 ) 连接sql server 数据库
- · ejb一则,franzy@163.net多多交流哦
- · WebSphere快速入门(19)
- · WebSphere快速入门(21)
- · WebSphere快速入门(1)
- · WebSphere快速入门(3)
- · WebSphere快速入门(5)
- · WebSphere快速入门(7)
- · WebSphere快速入门(9)
- · WebSphere快速入门(10)
- · WebSphere快速入门(11)
- · WebSphere快速入门(13)
- · 第三部分:布署和使用 Enterprise JavaBeans 组件(一)(转)
- · 第二部分:EJB 编程模型(转)
- · JavaBean 与 Enterprise JavaBean:有什么不同?(转)

