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

What are the sections into which a strut configuration file can be divided?

0 Answers  


advantages& 5 disadvantages of MVC architecture

6 Answers   Satyam, TCS,


Is struts 1 still supported?

0 Answers  


What is actioninvocation in struts2?

0 Answers  


Describe validate() and reset() methods.

0 Answers  






What is Struts Flow?

17 Answers   CTS, rsystems,


Can you explain struts.properties in struts2?

0 Answers  


What applications use apache struts?

0 Answers  


What are the two scope types for formbeans?

0 Answers  


What is the purpose of @action annotation?

0 Answers  


What's mvc pattern ?

0 Answers  


What does modeldriven interceptor?

0 Answers  


Categories