You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Horst Gaussmann <Sc...@t-online.de> on 2000/08/18 14:02:30 UTC

Tag as value of tag ?

Hi,

is it possible to use a Tag inside a Tag as a value of an attribut ?
like this 

  <tag:loggendIn yes="<tag:msg id="logout"/>" no="<tag:msg id="login"/>"/>

I always get errors while compiling this.

Maybe the following is the better choice, but harder to implement.

 <tag:loggendIn>
   <tag:msg id="logout"/>"
 <tag:else/>
   <tag:msg id="login"/>"
 <tag:loggendIn/>

thanx for tips horst
 


Re: Tag as value of tag ?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Horst Gaussmann wrote:

> Hi,
>
> is it possible to use a Tag inside a Tag as a value of an attribut ?
> like this
>
>   <tag:loggendIn yes="<tag:msg id="logout"/>" no="<tag:msg id="login"/>"/>
>
> I always get errors while compiling this.
>

That is because this is not legal JSP syntax.  You can only use scriptlet
expressions for attribute values, and even then only if you have declared your
attribute to accept runtime expression values in the TLD.

>
> Maybe the following is the better choice, but harder to implement.
>
>  <tag:loggendIn>
>    <tag:msg id="logout"/>"
>  <tag:else/>
>    <tag:msg id="login"/>"
>  <tag:loggendIn/>
>
> thanx for tips horst
>

This approach is better for lots of reasons -- not the least of which is that
it is much more XML-friendly, which will become increasingly important as
development tools improve their support for XML (in general) and JSP custom
tags (in particular).

Craig McClanahan