tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nauman Khan <>
Subject RE: dynamic attributes
Date Thu, 23 Nov 2000 12:22:29 GMT

The short answer is no. JSP syntax just doesn't support it. Shame, isnt it!!

-----Original Message-----
From: Stefan HÃ¥kans []
Sent: Thursday, November 23, 2000 8:22 AM
Subject: RE: dynamic attributes

I have a follow-up question on this topic.
Is there any way of putting a custom tag as attribute to another tag ?
<mytaglib:atag anattrib="<mytaglib:anothertag />" />

Now the only ways I can make these two tag communicate is by defining
variables, or putting one tag in the body of the other.
I would like to avoid both of them.

-----Original Message-----
From: Hans Bergsten []
Sent: den 23 november 2000 09:02
Subject: Re: dynamic attributes

Jeff Turner wrote:
> Hi,
> Is there any way to dynamically create attributes for JSP taglib elements?
> Eg, how would I do the following:
> <util:include
> url="/servlet/MyServlet?q=<%request.getParameter("param");%>" />
> ? I'd like Tomcat to first evaluate <% request.getParameter("param"); %>,
> and then feed that to <util:include url="..."/>.
> Cocoon ( handles the above as follows:
> <util:include>
>   <util:url>
>   /servlet/MyServlet?q=<xsp:expr>request.getParameter("param")</xsp:expr>
>   </util:url>
> </util:include>
> So every attribute also has an equivalent "nested element" form. That's
> possible because Cocoon XSP taglibs are written in XSLT, whereas JSP has a
> more rigid API-based model.
> Is any general way of doing this?

If you declare your attribute as a request-time attribute in the TLD,
you can assign it a value this way:

    url="<% "/servlet/MyServlet?q=" + request.getParameter("param") %>" />

See the JSP specification for details.

Hans Bergsten
Gefion Software

View raw message