Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JSF and the fly likes JSF or JSTL (don't care) loop though List of images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF or JSTL (don Watch "JSF or JSTL (don New topic

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

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys,

I'm trying to loop through a simple List<String> imagesList

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!

Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 183

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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16536

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: JSF or JSTL (don't care) loop though List of images