You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Frank Börncke <fb...@applicate.de> on 2003/10/20 12:00:15 UTC

Multiple attributes within an element - Is this a legal thing to do?

Hello,

defining a custom tag "DEFINESET" in a taglib having an
attribute called ELEMENT we want to use this attribute
multiple times as follows:

<x:DEFINESET
   ELEMENT = "x"
   ELEMENT = "y"   
   ELEMENT = "z"
/>

Deployed in a Tomcat environment this results in multiple
calls of the setter 'setELEMENT'. This allows us to collect
the elements in e.g. a HashSet.

Is this multiple usage of an attribute a legal thing to do?
Or is an attribute expected to be used only once in an element
context? I did not find any information concerning this topic.

Will this work in other servlet containers too?


Thanks in advance,

Frank Börncke

______________________________________________________
<applicate>, Hermann-Lingg-Str. 15, D-80336 München 
frank.boerncke@applicate.de    -    www.applicate.de 
Fon: + 49 (89) 54 47 9 48 2   oder   0700-APPLICATE 
Fax: + 49 (89) 54 47 9 48 9 
 

______________________________________________________
<applicate>, Hermann-Lingg-Str. 15, D-80336 München 
frank.boerncke@applicate.de    -    www.applicate.de 
Fon: + 49 (89) 54 47 9 48 2   oder   0700-APPLICATE 
Fax: + 49 (89) 54 47 9 48 9 
 

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


Re: Multiple attributes within an element - Is this a legal thing to do?

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Sorry, from all my understanding, thats just not allowed in XML. 
Attributes always have to be unique keys. When trying to build "sets" on 
a "key" I would recommend separate nested tags

<x:DEFINESET>
     <x:ELEMENT val="x"/>
     <x:ELEMENT val="y"/>
     <x:ELEMENT val="z"/>
</x:DEFINESET>

You can make a "public Collection getDefineset()" method in the 
DEFINESET tag. Then, in the ELEMENT jsp tag class you can lookup its 
parent (DEFINESET) and call this method to get the Collection of 
definitions and add any new ELEMENTS to it.

hope this helps some,
MArk

Frank Börncke wrote:
> Hello,
> 
> defining a custom tag "DEFINESET" in a taglib having an
> attribute called ELEMENT we want to use this attribute
> multiple times as follows:
> 
> <x:DEFINESET
>    ELEMENT = "x"
>    ELEMENT = "y"   
>    ELEMENT = "z"
> />
> 
> Deployed in a Tomcat environment this results in multiple
> calls of the setter 'setELEMENT'. This allows us to collect
> the elements in e.g. a HashSet.
> 
> Is this multiple usage of an attribute a legal thing to do?
> Or is an attribute expected to be used only once in an element
> context? I did not find any information concerning this topic.
> 
> Will this work in other servlet containers too?
> 
> 
> Thanks in advance,
> 
> Frank Börncke
> 
> ______________________________________________________
> <applicate>, Hermann-Lingg-Str. 15, D-80336 München 
> frank.boerncke@applicate.de    -    www.applicate.de 
> Fon: + 49 (89) 54 47 9 48 2   oder   0700-APPLICATE 
> Fax: + 49 (89) 54 47 9 48 9 
>  
> 
> ______________________________________________________
> <applicate>, Hermann-Lingg-Str. 15, D-80336 München 
> frank.boerncke@applicate.de    -    www.applicate.de 
> Fon: + 49 (89) 54 47 9 48 2   oder   0700-APPLICATE 
> Fax: + 49 (89) 54 47 9 48 9 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu


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