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 15:56:16 UTC

AW: Multiple attributes within an element - Is this a legal thingto do?

Thanks for your reply.

>Sorry, from all my understanding, thats just not allowed in XML.


JSP looks like XML but is it required for JSP to exactly match
the XML restrictions?

At least multiple attributes work in Tomcat 4.1.12 quite fine.
If I use this feature(?) in our project, I am am not sure if 
this will create problems in future versions of Tomcat or other 
servlet containers. The JSP specification seems to be not
clear in this point (at least I found no statement concerning
this topic).

Frank


-----Ursprüngliche Nachricht-----
Von: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu]
Gesendet: Montag, 20. Oktober 2003 15:48
An: Tag Libraries Users List
Betreff: Re: Multiple attributes within an element - Is this a
legal
thingto do?


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


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


Re: AW: Multiple attributes within an element - Is this a legal thingto do?

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.

Frank Börncke wrote:
> Thanks for your reply.
> 
> 
>>Sorry, from all my understanding, thats just not allowed in XML.
> 
> 
> 
> JSP looks like XML but is it required for JSP to exactly match
> the XML restrictions?
> 

I would avoid anything thats not XML, JSP's can also be written as legal 
XML. If you violate the XML standard then your tags cannot be used in 
JSP's which adhere to XML standards. In a world where designs are 
rapidly moving towards XML (with the introduction of EL and jsp tags  to 
replace <%%> scriptlets, thinking ahead would be a wise thing to do.

> At least multiple attributes work in Tomcat 4.1.12 quite fine.

I doubt this was really meant to be a feature.

> If I use this feature(?) in our project, I am am not sure if 
> this will create problems in future versions of Tomcat or other 
> servlet containers. The JSP specification seems to be not
> clear in this point (at least I found no statement concerning
> this topic).
> 

It could very well be the case that your tags would not work in the 
future, or even on other current vendors JSP/Servlet Engines. While this 
may not be a concern to you now on your particular project, I would 
advise against it if you want any sort of future reusability. I don't 
think the strategy your seeking to employ is one that was intended by 
the designers of JSP.

just my thoughts on the subject,
Mark

> 
> -----Ursprüngliche Nachricht-----
> Von: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu]
> Gesendet: Montag, 20. Oktober 2003 15:48
> An: Tag Libraries Users List
> Betreff: Re: Multiple attributes within an element - Is this a
> legal
> thingto do?
> 
> 
> 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