i have list of values(e.g 100).
using logic:iterate, how can i print the multiples of 5th
element?
how the logic:iterate will understand the multiples of 5.




Answers were Sorted based on User's Feedback



i have list of values(e.g 100). using logic:iterate, how can i print the multiples of 5th elemen..

Answer / murali krishna yella

ya.. this will surely work fine

<logic:iterate id="item" name="listName" scope="request"
indexId="index">
<%
if( (index%5)==0 ){
<bean:write name="item"/>
}
%>
</logic:iterate>

Is This Answer Correct ?    22 Yes 2 No

i have list of values(e.g 100). using logic:iterate, how can i print the multiples of 5th elemen..

Answer / sharmila

You can try "indexId" param in the logic:iterate

It will give us the index value. So, inside the loop, you
can check if index value is multiple of 5 then only show the
record from the bean.

Is This Answer Correct ?    6 Yes 5 No

Post New Answer




More Struts Interview Questions

How client side validation is enabled on a jsp form?

0 Answers  


What is the purpose of redirect result type?

0 Answers  


What is the procedure of operation of a form tag?

0 Answers  


What is the use of execAndWait interceptor?

0 Answers  


What is an interceptor stack?

0 Answers  






what is use of assert keyword in java..?

1 Answers  


what is the diff between struts1.0 and struts2.0

2 Answers   Intel,


What is the purpose of constant tag in struts.xml?

0 Answers  


Are interceptors thread safe?

0 Answers  


Explain the complete struts validator framework.

0 Answers  


Explain how to work with error tags?

0 Answers  


Who wrote struts?

0 Answers  






Categories