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 can i fetch combo box value into my DAO using struts 2?

3 Answers  


What are action errors?

0 Answers  


What is the purpose of @keyproperty annotation annotation?

0 Answers  


What do you mean by actionmapping?

0 Answers  


Explain about tiles?

0 Answers  


What is spring hibernate and struts in java?

0 Answers  


What are the classes used as part of struts framework ?

0 Answers  


What are the core classes of the struts framework?

0 Answers  


why do we typecast ActionForm into out plain java bean class in Action class?

5 Answers  


what is the disadvantage of struts frame work?

11 Answers  


Name the different types of actions found in struts.

0 Answers  


Is struts compatible with other java technologies?

0 Answers  


Categories