陷阱和jsp陷入两难境地

时间:2012-10-03 10:05:36

标签: jsp struts2 iterator

我有这个迭代器的问题....它不会得到迭代器的索引,所以我可以放入“if”...它直接转到其他...我想我是没有正确获得索引,但我不知道如何...请帮助,如果你可以

 <s:iterator  value="fileNames" status="idx">
   <s:set name="index" value="#idx.index"/> 
            <s:if test="%(#index)=4" >
        <div id="ngg-image-01"  class="ngg-gallery-thumbnail-box">
        <div class="ngg-gallery-thumbnail">
        <a id="1" rel="prettyPhoto[set_1]"                                                                      
                 href="${pageContext.request.contextPath}/userfiles/images/inside/7-  
                 days/prettyPhoto[set_1]/<s:property/>" alt="<s:property/>"><br />
                <img title="revederepensiune-vara-02"                                         
         src="userfiles/images/inside/7-days/prettyPhoto[set_1]/thmbs/<s:property/>" 
        alt="" width="89" height="66" /><br /></a></div>
                                </div> 
            </s:if>

              <s:else> 
                <div id="ngg-image-01" class="ngg-gallery-thumbnail-box">
        <div class="ngg-gallery-thumbnail">
        <a id="1" rel="prettyPhoto[set_1]" 
           href="${pageContext.request.contextPath}/userfiles/images/inside/7-
           days/prettyPhoto[set_1]/<s:property/>" alt="<s:property/>"><br /> 
      <img title="revederepensiune-vara-02"
     src="userfiles/images/inside/7-days/prettyPhoto[set_1]/thmbs/<s:property/>" 
     alt="" width="89" height="66" /><br /></a></div>
                                </div> 
              </s:else>              




     </s:iterator>

1 个答案:

答案 0 :(得分:1)

<s:if标记的语法错误。更改测试属性 - 括号应为大括号,=应为==,如下所示:

<s:if test="%{#index==4}" >