The following works for me in Tomcat 3.1_m1

<mylib:mytag attribute1="<%= new Date().toString() %>"/>

In your taglib.tld be sure to set the rtexprvalue of your tag:

    <tag>
        <name>mytag</name>
        <tagclass>path.to.myClass</tagclass>
        <bodycontent>empty</bodycontent>
        <attribute>
            <name>attribute1</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>


Damian

Tim Fox wrote:
>
> Is there any way, using taglibs to get dynamic attributes passed into
> the tag code, from my understanding it seems that the attributes get
> passed as literals.
>
> For example:
>
> <mylib:mytag attribute1="(new Date()).toString()" />
>
> In my setter method for attribute1 in my tag code the string "(new
> Date()).toString()" is passed in, rather than the evaluation of the
> expression (new Date()).toString().
>
> Can anyone shed any light on whether this is possible with jsp?
>
> (In theory there seems no reason why this is impossible, since the jsp
> compiler could insert a few lines in the generated class for the jsp
> page, like:
>
> String tmp = (new Date()).toString();
> ...
> mytagobj.setAttribute1(tmp);
>
> )
>
> --
> Tim Fox (��o)
>
> Hyperlink plc
> http://hyperlink.com
>
> email: [EMAIL PROTECTED]
> phone: +44 (0) 207 240 8121
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to