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 is the use of forwardaction?

0 Answers  


What is the role of action class in struts?

0 Answers  


How do u provide security to ur project?(Banking domain project)

0 Answers   Polaris,


Explain the difference between dispatchaction and lookupdispatchaction in struts?

0 Answers  


when we enter the data in the form how it is stored in formbean class setter and getter methods?

1 Answers   TCS, Wipro,






How display data base errors on web console by using the Struts Framework?

2 Answers  


what is purpose cvs and vss in eclipse?

2 Answers  


when connecting with the database,if database server is down,ho can we handle this exception in struts,how can we send error message to the user?

4 Answers   Wipro,


What are interceptors in struts 2?

0 Answers  


What is the configuration files used in struts?

0 Answers  


What is the purpose of @expressionvalidator annotation?

0 Answers  


How to display validation errors on jsp page?

0 Answers  


Categories