my dog learned polymorphism
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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Iterating using forEach " Watch "Iterating using forEach " New topic

Iterating using forEach

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761
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: 761
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="" 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: 761
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.
I agree. Here's the link:
subject: Iterating using forEach
It's not a secret anymore!