<logic:notEmpty name="formBean" property="terminals">
<logic:iterate id="terminal" name="formBean"
property="terminals" indexId="index">
<TR>
<td height="26" align="left" width="8%">
<html:radio idName="terminal" property="terminalId" name="formBean" value="id">
</html:radio>
</td>
<td height="26" align="left" width="38%"><bean:write
name="terminal" property="sn" /></td>
<td height="26" align="left" width="21%"><bean:write
name="terminal" property="osName" /></td>
<td width="33%" height="26" align="left"><bean:write
name="terminal" property="description" /></td>
</TR>
</logic:iterate>
</logic:notEmpty>
<logic:iterate id="terminal" name="formBean"
property="terminals" indexId="index">
<TR>
<td height="26" align="left" width="8%">
<html:radio idName="terminal" property="terminalId" name="formBean" value="id">
</html:radio>
</td>
<td height="26" align="left" width="38%"><bean:write
name="terminal" property="sn" /></td>
<td height="26" align="left" width="21%"><bean:write
name="terminal" property="osName" /></td>
<td width="33%" height="26" align="left"><bean:write
name="terminal" property="description" /></td>
</TR>
</logic:iterate>
</logic:notEmpty>
解决方案 »
- jpa怎么调用带out参数的存储过程
- 关于frame的一个问题!!急!!希望高手帮个忙!万分感激!!
- Java,求各位高手指点,感激不尽...
- 北京国际商务学院一年制得文凭真得假得
- ????net.sf.hibernate.QueryException: unexpected token: as [select c from courseinfo as c]
- 重发贴,高分请教!刚才分太少了。java 中如何实现跨数据库连接?
- 请教windows如何访问linux上的文件
- 求用RMI实现CLIENT,SERVER间传输文件的实例。
- 如何在JBuilder7中连接远程MS SQL2k数据库?
- mysql 连接数暴涨 求处理方法
- Hibernate could not execute query
- 启动J2EE服务器时出现了问题,能帮偶解决一下么
其中为terminal pojo
我的信箱:[email protected]
我的信箱:[email protected]
<logic:iterate name="dataList" id="item">
<logic:present name="item" property="name">
Your Name:<bean:write name="item" property="name"/>
</logic:present>
</logic:iterate>dateList是一个List,其中含有Map
name是Map中的key.
<%
HashMap months = new HashMap();
months.put("Jan","January");
months.put("Feb","February");
months.put("Mar","March");
request.setAttribute("months",months);
%>
<logic:present name="months">
<logic:iterate id="element" indexId="ind" name="months">
<bean:write name="ind" />
<bean:write name="element" property="key" />
<bean:write name="element" property="value" /> <br>
</ogic:iterate> <p>
</logic:present>输出结果为:
0.Mar:March
1.Feb:February
2.Jan:January
if(true){}
if(!false){}
 <logic:present>
 <logic:notPresent>
它们的功能是在计算标记体之前判断特定的项目是否存在。标记的属性和属性值决定了要进行检查的项目。
属性 描述
Cookie 由这个属性指定的cookie将被检查是否存在
Header 由这个属性指定的请求标头将被检查是否存在
parameter 由这个属性指定的请求参数将被检查是否存在
Name 如果没有设置property属性,那么有这个属性指定的bean将被检查是否存在。如果设置
了那么bean和bean属性都将被检查是否存在。
property 检查有name属性指定的bean中是否存在指定的属性
Scope 如果指定了bean的名称,这就是bean的作用域。如果没有指定作用域,搜索的范围从页到应
用程序作用域。
Role 检查当前已经确认的用户是否属于特殊的角色
User 检查当前已经确认的用户是否有特定的名称
例如:
<logic:notPresent name=”bean” property=”prop” scope=”page”>
The bean property bean.prop is not present
</logic:notPresent>
标记判断在页作用域中是否存在一个名为”bean”的bean,并且bean有一个prop属性,不存时就执行标签包含的内容<logic:present>则是存在时执行标签包含的内容在逻辑标记库中定义了<logic:iterate>标记,它能够根据特定集合中元素的数目对标记体的内容进行重复的检查。集合的类型可以是java.util.Iterator,java.util.Collection
,java.util.Map或是一个数组。有三种方法可以定义这个集合:
 使用运行时间表达式来返回一个属性集合的集合
 将集合定义为bean,并且使用name属性指定存储属性的名称。
 使用name属性定义一个bean,并且使用property属性定义一个返回集合的bean属性。
当前元素的集合会被定义为一个页作用域的bean。属性如下,所有这些属性都能使用运行时表达式。
属性 描述
collection 如果没有设置name属性,它就指定了要进行重复的集合
Id 页作用域bean和脚本变量的名称,它保存着集合中当前元素的句柄
indexed 页作用域JSP bean的名称,它包含着每次重复完成后集合的当前索引
Length 重复的最大次数
Name 作为集合的bean的名称,或是一个bean名称,它由property属性定义的属性,是个集合
Offset 重复开始位置的索引
property 作为集合的Bean属性的名称
Scope 如果指定了bean名称,这个属性设置bean的作用域。若没有设置,搜索范围从页到应用程序作用域
Type 为当前定义的页作用域bean的类型
例如:
<logic:iterate id=”currentInt” collection=”<% =myList %>” type=”java.lang.Integer”
offset=”1”
length=”2”>
<% =currentint %>
</logic:iterate>
代码将从列表中的第一个元素开始重复两个元素并且能够让当前元素作为页作用域和java.lang.Integer类型的脚本变量来使用。也就是说,如果myList包含元素1,2,3,4等,代码将会打印1和2。