aspose file tools*
The moose likes JSP and the fly likes Iterating using forEach Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Iterating using forEach " Watch "Iterating using forEach " New topic
Author

Iterating using forEach

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
hi i have list of objects in the moduleList, the size of the list is 8 but i am wondering how do i iterate through this loop.

how does forEach work ?

in the code bellow i have hard coded the index 1,

I don't want to use scriptlets in my jsp.



Can anybody help me out with this...


Jigar Naik


Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
ok i was missing many steps.

now i have inclided jstl 1.2.jar and standard.jar in my class path.

added entry in web.xml

added entry in jsp as bellow

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

and try to access the data. as bellow


i m getting the result but its wrong. there are 8 rows in my table but its printing only the last row 8 times.

what may be the issue.

i am new to JSTL.

please help me it.
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Kindly show us what is there in your "moduleList" object. What data has you set in it?
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
hey Patricia,

Thanks for the reply...

Well i've checked that moduleList object which i was setting in the request scope, moduleList object was not containing the proper values.

Now it's working fine.

Thanks a lot.
Regards,
Jigar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterating using forEach
 
Similar Threads
Alternating color of table rows in a forEach tag (JSTL)
Using Two ArrayLists For One Table
Iteration of List in JSP
Beans and c:forEach
jstl + forEach + x number of items per row