• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterating using forEach

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kindly show us what is there in your "moduleList" object. What data has you set in it?
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic