1 Reply Latest reply on Nov 21, 2007 9:17 PM by sstrenn

    EL expression for accessing a set?

    Jaime Martin Apprentice

      Hi,
      I wonder if there is an EL expression for accessing a set?
      For instance, I´ve this objects:

      public class AssetType implements java.io.Serializable {
      
       private long idAsset;
       private String type;
      
       private Set<Instrument> instruments = new HashSet<Instrument>(0);
      ...
      
      public class Instrument implements java.io.Serializable {
      
       private String securityName;
      ..
      

      In a xhtml I want to display the securityNameof the first item in the instruments set.

      Something like this, but it doesn´t work
      #{assetType[0].internalOptionNumber}
      

      In java, it´s easy, for instance to display all of them: (yeah, I know an iterator would be fine as well, this is just a sample way of accessing)
       public String getSecurityName() {
       System.out.println("getSecurityName - getInstruments size:"+instruments.size());
       String secName ="";
       for( Instrument ins : instruments ) {
       secName = ins.getSecurityName();
       System.out.println("SecurityName" + secName );
       }
       return secName;
       }
      

      Any way to access a set from an EL expression?
      thanks in advance!