<div style="overflow: auto;height: 100%">
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolor="ffffff" bordercolordark="#ffffff" bordercolorlight="B9B9B9" >
<tr>
<th class="sortable" bgcolor="#EFEFEF" width="13%">走查对象编号</th>
<th class="sortable" bgcolor="#EFEFEF" width="15%">走查对象名称</th>
<th class="sortable" bgcolor="#EFEFEF" width="10%">走查人</th>
<th class="sortable" bgcolor="#EFEFEF" width="10%">走查时间</th>
<th class="sortable" bgcolor="#EFEFEF" width="30%">走查项名称</th>
<th class="sortable" bgcolor="#EFEFEF" width="22%" align="center">走查结果</th>
</tr>
<s:iterator id="detailReviewActivityObject" value="detailReviewActivityObjects" status="status">
<s:set name="reviewActivityResultSize" value="%{ tempReviewActivityResults.size() }"/>
<tr>
<td rowspan=${reviewActivityResultSize }>${detailReviewActivityObject.targetId}</td>
<td rowspan=${reviewActivityResultSize }>${detailReviewActivityObject.targetName}</td>
<td rowspan=${reviewActivityResultSize }>${detailReviewActivityObject.userName} </td>
<td rowspan=${reviewActivityResultSize }><fmt:formatDate value="${detailReviewActivityObject.reviewDate}" pattern="yyyy-MM-dd"/></td>
<td align="left">
<c:if test="${reviewActivityResultSize>0}">
<s:set name="reviewActivityResultWalkthroughReviewItemName" value="%{ tempReviewActivityResults[0].walkthroughReviewItem.name }"/>
${ tempReviewActivityResults[0].walkthroughReviewItem.name }
</c:if>
</td>
<td align="center">
<c:if test="${reviewActivityResultSize>0}">
<s:set name="reviewActivityResultResult" value="%{ tempReviewActivityResults[0].result }"/>
<input disabled="disabled" type="radio" <c:if test="${reviewActivityResultResult=='01'}">checked</c:if> value="01"/>通过
<input disabled="disabled" type="radio" <c:if test="${reviewActivityResultResult=='02'}">checked</c:if> value="02"/>不通过
<input disabled="disabled" type="radio" <c:if test="${reviewActivityResultResult=='03'}">checked</c:if> value="03"/>不适用
</c:if>
</td>
</tr>
<s:iterator id="tempReviewActivityResult" value="tempReviewActivityResults" status="sta">
<c:if test="${ sta.index!=0}">
<tr>
<td align="left">${tempReviewActivityResult.walkthroughReviewItem.name}</td>
<td align="center">
<input disabled="disabled" type="radio" <c:if test="${tempReviewActivityResult.result=='01'}">checked</c:if> value="01"/>通过
<input disabled="disabled" type="radio" <c:if test="${tempReviewActivityResult.result=='02'}">checked</c:if> value="02"/>不通过
<input disabled="disabled" type="radio" <c:if test="${tempReviewActivityResult.result=='03'}">checked</c:if> value="03"/>不适用
</td>
</tr>
</c:if>
</s:iterator>
</s:iterator>
</table>
</div>
*********************************************************************************
一行显示四个,未全的补全.
<table>
<s:iterator value="sysfiles" status="status">
<s:if test="#status.index % 4 == 0">
<tr>
</s:if>
<td>xxxx</td>
<s:if test="#status.last">
<s:set name="O" value="(4-((#status.index+1) % 4)) "/>
<s:bean name="org.apache.struts2.util.Counter" id="counter">
<s:param name="first" value="1" />
<s:param name="last" value="#O" />
<s:iterator>
<td>num:<s:property value="current-1"/> </td>
</s:iterator>
</s:bean>
</s:if>
<s:if test="#status.index % 4 == 3 || #status.last">
</tr>
</s:if>
</s:iterator>
</table>
struts2提供了<s:bean/>标签,且提供了一个bean类:org.apache.struts2.util.Counter,该类中有first、last等属性,可用使用它获取自增值,如下:
其中first属性指定循环起始值,last指定循环终止值,其它相关属性可以查看org.apache.struts2.util.Counter类源码。在下面迭代器中输入循环的当前值,即:current-1
<s:bean name="org.apache.struts2.util.Counter" id="counter">
<s:param name="first" value="1" />
<s:param name="last" value="10" />
<s:iterator>
<s:property/>
<s:property value="current-1"/>
</s:iterator>
</s:bean>
iterator标签有如下方法:
boolean isEven() 当前迭代元素索引是否为偶数;
boolean isOdd() 当前迭代元素索引是否为奇数;
boolean isLast() 是否为最后一条元素;
boolean isFirst() 是否为第一条元素。
int getIndex() 返回当前迭代元素的索引
遍历数组
<s:iterator value="{'1','2','3','4','5'}" id='number'>
<s:property value='#number'/>
</s:iterator>
遍历List
<s:iterator value="sysfiles" id="sys">
<s:property value="#sys.name" />
</s:iterator>
<s:iterator value="sysfiles" >
<s:property value="name" /> 或 ${name }
</s:iterator>
<s:iterator value="%{sysfiles}" >
${name }或<s:property value="name" />
</s:iterator>
<s:iterator value="%{sysfiles}" id="sys" status="status">
index is : <s:property value='#status.index'/>
attrName is : <s:property value='%{sysfiles[#status.index].name}'/>
attrName is : <s:property value='#sys.name'/> or <s:property value='%{#sys.name}'/>
</s:iterator>
遍历Map
<s:iterator value="#{'foo1':'bar1', 'foo2':'bar2'}" id="id" status="st">
key: <s:property value='key'/>
value:<s:property value='value'/>
index:<s:property value='#st.index'/>
key:${id.key }
key:${id.value }
</s:iterator>
"%"符号用途是计算OGNL表达式的值。
"$"有两个主要用途a.用于在国际化资源文件中,引用OGNL表达式.b.在Struts2配置文件中,引用OGNL表达式.
#符号用途一般有三种. a.访问非根对象属性.b.用来构造Map,例如示例中的#{'foo1':'bar1', 'foo2':'bar2'}.
c.用于过滤和投影(projecting)集合,如示例中的persons.{?#this.age>20}.
使用过的标签:
<s:if test=""></s:if>
<s:elseif test=""></s:elseif>
<s:else></s:else>
<s:action name=""></s:action>
<s:form></s:form>
<s:hidden></s:hidden>
<s:text name=""></s:text>
<s:textarea></s:textarea>
<s:textfield></s:textfield>
<s:iterator></s:iterator>
<s:property/>
<s:set></s:set>
<s:bean name=""></s:bean>
<s:url></s:url>
<s:submit></s:submit>
<s:reset></s:reset>
<s:password></s:password>
<s:label></s:label>
<s:file></s:file>
<s:radio name="issue.status" list="#{'2':#Open,'3':#Fixed}" />
<input name="model.notice.meetingDate" type="text" value="<s:date name="model.notice.realMeetingDate" format="yyyy-MM-dd"/>" />
<a href="<s:url value="/archie/draft.action"><s:param name="archieId">${archieRelation.archie.id}</s:param></s:url>" target="_blank">点击</a>
struct2标签使用一
最新推荐文章于 2020-11-07 15:29:53 发布