struts - logic:iterate comparing the next value -
i trying perform comparison current submission next. have following code:
<logic:iterate id="anitem" name="datapage" property="filingslist" indexid="myind"> <bean:define id="currentsubmissionid" type="java.lang.string" name="anitem" property="denserank"/>
i like:
<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>
thanks,
tom
1. create temp string variable "", 2. store current string here 3. iterate, , compare. 4. iterate check if equal or not. 5. if equal print else copy next string variable.
here code.
string[] somearrayofstrings; // store strings here. can use arraylist too. string tempstring = ""; // recommend use arraylist. for(int count=0; count<somearrayofstrings.length-1; count++){ tempstring = somearrayofstrings[count]; if(tempstring.equalsignorecase(somearrayofstrings[count+1])){ system.out.print(tempstring); } }
let me know if helped.
Comments
Post a Comment