tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Mahar" <>
Subject RE: [JSTL] Indexed array variable (and associations)
Date Wed, 02 Jun 2004 16:18:18 GMT
Very clever!  This is an interesting way around JSTL's array creation
and assignment limitations.  You represent the array as an XML document
and instead of indexing the array using EL, you use the JSTL XML tags
and XPath.

Of course, if you define tag that accepts such a parsed XML array as an
attribute, you should make this clear in the tag documentation.


> -----Original Message-----
> From: Helios Alonso [] 
> Sent: June 2, 2004 12:02 PM
> To: Tag Libraries Users List
> Subject: RE: [JSTL] Indexed array variable (and associations)
> At 12:22 02/06/2004 -0300, you wrote:
> >Well, c:set can set associations.
> >
> >If the code I saw is fine, you can do this:
> >
> ><c:set target="myAsoc" property="name" value="John"/>
> >to add an entry in myAsoc: Map
> >telling that "name" correspond to "John"
> >
> >how do I do to access it?  ${myAsoc['name']}   ?
> Thanks (I finally checked the code X-)
> So, what is missing is setting.
> For setting a complete array I'd use:
> <c:set var="myArray">
>          <array>
>                  <item><array>
>                          <item>Simon</item>
>                          <item>75</item>
>                          <item>70</item>
>                  </array></item>
>                  <item><array>
>                          <item>Derek</item>
>                          <item>75</item>
>                          <item>70</item>
>                  </array></item>
>                  <item><array>
>                          <item>Helios</item>
>                          <item>75</item>
>                          <item>70</item>
>                  </array></item>
>          </array>
> </c:set>
> Where array sets parent tag's value attribute (I hope set tag 
> allow inner 
> body processing).  Array would have a Vector for collecting 
> items.  On 
> doEndTag it would convert it to an array and set it to parent tag.
> Item tag would look for an array parent tag and add a new 
> value.  Its value 
> would be by property, by body string, or letting an inner tag set it 
> (<item><array> case).
> We can use similar code to <choose><when> handlers.
> But... it remembers me xml... maybe it's a better aproach 
> (but I'm not sure 
> about the capabilities)
NOTICE: This email contains privileged and confidential information and is intended only for
the individual to whom it is addressed. If you are not the named addressee, you should not
disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail
if you have received this transmission by mistake and delete this communication from your
system. E-mail transmission cannot be guaranteed to be secured or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.

AVIS: Le présent courriel contient des renseignements de nature privilégiée et confidentielle
et n’est destiné qu'à la personne à qui il est adressé. Si vous n’êtes pas le destinataire
prévu, vous êtes par les présentes avisés que toute diffusion, distribution ou reproduction
de cette communication est strictement interdite.  Si vous avez reçu ce courriel par erreur,
veuillez en aviser immédiatement l’expéditeur et le supprimer de votre système. Notez que
la transmission de courriel ne peut en aucun cas être considéré comme inviolable ou exempt
d’erreur puisque les informations qu’il contient pourraient être interceptés, corrompues,
perdues, détruites, arrivées en retard ou incomplètes ou contenir un virus.  

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message