0

我正在尝试与当前提交的下一个进行比较。我有以下代码:

<logic:iterate id="anItem" name="dataPage" property="filingsList" 
    indexId="myInd">
    <bean:define id="currentSubmissionId" type="java.lang.String" 
    name="anItem" property="denseRank"/>

我想做类似的事情:

<logic:equal name="dataPage" property="currentSubmissionId"
 value="nextSubmissionId???">

    <img id="plus<%=rowCount%>" class="cursor" 
       src="<icis2:icisRes/>images/plus.gif" 
       onclick="toggle('<%=rowCount%>', this, 
       jQuery('#minus<%=rowCount%>'))"/>

    <img id="minus<%=rowCount%>" class="cursor" 
       src="<icis2:icisRes/>images/minus.gif" onclick="toggle('<%=rowCount%>', 
       this, jQuery('#plus<%=rowCount%>'))" style="display: none;"/>
</logic:equal>

谢谢,

汤姆

4

1 回答 1

0
1. Create a temp string variable to "",
2. Store the current String here
3. Iterate, and compare. 
4. As you iterate check if equal or not. 
5. If equal print else copy next string to the variable.

这是代码。

    String[] someArrayOfStrings;  // Store the Strings here. You can use ArrayList too.
    String tempString = "";       // Recommend to use ArrayList.

    for(int count=0; count<someArrayOfStrings.length-1; count++){
       tempString = someArrayOfStrings[count];

       if(tempString.equalsIgnoreCase(someArrayOfStrings[count+1])){
            System.out.print(tempString);    
        }
    }

让我知道它是否有帮助。

于 2013-07-23T21:23:45.243 回答