1

I'm working with LastFM api, let's say I have a class called Artist which I call in this dataTable:

<h:dataTable var="artist" value="#{personEAO.topArtists}" >
    <h:column>Artist : #{artist.name} </h:column>
</h:dataTable>

Artit have a field which refers to his picture :

artist.getImageURL(ImageSize.LARGE)

Which works fine, but how do I call this method in my jsf page using dataTable ?

Valter Silva
  • 16,446
  • 52
  • 137
  • 218
  • Check this question out: http://stackoverflow.com/questions/3916871/passing-a-enum-value-as-a-parameter-from-jsf – djmj May 08 '12 at 01:03

1 Answers1

1

I searched around for Javadocs, but I couldn't find them anywhere. The answer depends on what kind of constant ImageSize.LARGE is.

If ImageSize is an enum, just do:

<h:graphicImage value="#{artist.getImageURL('LARGE')}" />

But if it isn't and is thus a public static constant, then one of the ways is to wrap it in some helper bean which returns exactly that:

<h:graphicImage value="#{artist.getImageURL(someHelperBean.ImageSize_LARGE)}" />

I of course assume that your environment supports EL 2.2.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555