Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Iterating using forEach

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic