tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: Easy EL question
Date Mon, 08 Aug 2005 11:20:41 GMT
Hi,

With what you supplied, the answer was the best you could have expected. The deletedDma item
per loop iteration is of type MapEntry. This has getKey and getValue, hence why you can call
deletedDma.key and deletedDma.value. 

In html your link would be

<a href="/DMAAssistant/ChooseDeletedDMAToCancelRemove?id=${deletedDma.value.id}">Remove</a>

I am not sure if you can pass this into the html:link tag.

Try ...

// you don't need this block by the way
<c:catch>
  <c:set var="deletedDmas" 
    value="${dmaAssistantSession.deletedDmasSimple}"/>
</c:catch>


<ul id="overviewDeletedDmas">
  <c:forEach items="${dmaAssistantSession.deletedDmasSimple}" var="deletedDma">

    <li>
      <html:link 
action="/DMAAssistant/ChooseDeletedDMAToCancelRemove"
             paramId="id" paramName="deletedDma.value" paramProperty="id">
             <bean:message name="deletedDma.value" property="label" />
      </html:link>
    </li>
  </c:forEach>
</ul>

> -----Original Message-----
> From: Guillaume Lederrey [mailto:guillaume.lederrey@gmail.com]
> Sent: 08 August 2005 12:10
> To: Tomcat Users List
> Subject: Re: Easy EL question
> 
> 
>   Thanks for your answer !  But I'm afraid I dont really understand
> how to use it ...  Do you mean I should iterate on the keys of my Map
> ? But then the question is of course "How do I iterate on the keys ?".
> 
>   Maybe I should be more precise in my example, so here is my actual
> code (which doesnt work).
> 
> dmaAssistantSession.deletedDmasSimple is a Map of beans (id, label).
> The key to the Map is the id of the bean itself (but I dont use the
> key here).
> 
> <c:catch>
>   <c:set var="deletedDmas" 
> value="${dmaAssistantSession.deletedDmasSimple}"/>
> </c:catch>
> 
>    <ul id="overviewDeletedDmas">
>       <c:forEach items="${deletedDmas}" var="deletedDma">
>         <li>
>           <html:link 
> action="/DMAAssistant/ChooseDeletedDMAToCancelRemove"
>             paramId="id" paramName="deletedDma" paramProperty="id">
>             <bean:message name="deletedDma" property="label"/>
>           </html:link>
>         </li>
>       </c:forEach>
>     </ul>
> 
>   Thanks a lot for the answer, but I would be even more thankfull if a
> bit more explanation goes with it ...
> 
> On 8/8/05, Allistair Crossley <Allistair.Crossley@qas.com> wrote:
> > you use .key or .value, e.g
> > 
> > item.value['key']
> > item.key
> > 
> > Allistair
> > 
> > > -----Original Message-----
> > > From: Guillaume Lederrey [mailto:guillaume.lederrey@gmail.com]
> > > Sent: 08 August 2005 10:34
> > > To: Tomcat Users List
> > > Subject: Easy EL question
> > >
> > >
> > >   Hello !
> > >
> > >   I'm still having problem with all the different syntax used in
> > > JSP... so excuse my question if it sound really stupid !
> > >
> > >   I'm having to iterate on the "values" of a "Map". So I'd like
> > > something like that :
> > >
> > > <c:catch>
> > >   <c:set var="items" value="${itemsMap.values}"/>
> > > </c:catch>
> > >
> > > <c:forEach items="${items}" var="item">
> > >   [do something]
> > > </c:forEach>
> > >
> > >   Of course, it doesnt work because there is no "getter" 
> in a "Map" to
> > > get the values ...  There is probably a very easy and 
> standard way to
> > > do exactly that ... could you help me on that one ?
> > >
> > >   Thanks
> > >
> > >
> > >      Guillaume
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > >
> > >
> > 
> > 
> > <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
> > -------------------------------------------------------
> > QAS Ltd.
> > Registered in England: No 2582055
> > Registered in Australia: No 082 851 474
> > -------------------------------------------------------
> > </FONT>
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message