• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF or JSTL (don't care) loop though List of images

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I'm trying to loop through a simple List<String> imagesList
imageList.add("http:www.awebsite.com/images.firstimage.jpg")
imageList.add("http:www.awebsite.com/images.secondimage.jpg")
imageList.add("http:www.awebsite.com/images.thirdimage.jpg")

I have tried both JSTL & JSF and can't get this to work, on both occasions I get the same issue. Only the final image is displayed.
If I output just the URL (no IMG tag) I get all 3 results, so it's the IMG tag that's breaking it (I guess)


As I say, don;t care if it's JSF (repeat, datagrid) or JSTL (forEach)
My loop (JSTL):


Any help on how to get this working would be great!

Thanks
 
Ranch Hand
Posts: 185
Netbeans IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For JSF you should download the images first and create a resources folder under your projects root folder. ie. beside WEB-INF. Then use ui:repeat to loop through the images.



using the bean...



Give that a shot.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSTL+JSF are a recipe for frustration. Avoid JSTL with JSF. JSF has native constructs that do the same thing, only better integrated with JSF.

I also recommend avoiding the ui:repeat tag except for cases where a less programmatic layout control (such as h:dataTable) aren't possible. JSF Views are supposed to be graphic templates, not code.
 
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic