Hi Devon,
See below...
[EMAIL PROTECTED] wrote:
>
> > JSPTL allows you to do the following by using the Simplest
> > Possible Expression Language (SPEL) provided with the
> > reference implementation:
> >
> > <tag attribute="$foo.bar.baz"/>
> > <tag attribute="$param:paramName"/>
>
> The above examples make things prettier but don't really
> add much functionality over JSP expressions. The original
> author in this thread was looking for something like:
>
> <tag attribute="<bean:write bean="..." property="..." />
>
> The problem is that the example isn't very good because it
> is only a <bean:write> which is pretty much just a lookup
> and can be handled with JSP expressions. But if we take
> another example such as:
>
> <tag attribute="<bean:message key="..." />">
>
> The problem is clearer. The <bean:message> taglib adds some
> significant functionality and isn't just a bean access. Stuff
> like this has caused me endless frustration.
>
> If SPEL had some way of calling a taglib as if it were a
> function, I'd be dancing on my desk. Something like:
>
> <tag attribute="bean:message(key="yourkeyhere")" />
>
> Seems like the hardest part of adding this is coming up with
> a reasonable syntax. But I don't believe it's been done yet.
> I do note, however, that that JSPTL provides a way of plugging
> in expression languages. So maybe this will encourage future
> experimentation in this direction.
>
> Devon
Using your example:
<tag attribute="<bean:message key="..." />">
This could be done in JSPTL in the following way:
<jx:set var="msg"><bean:message key="..." /></jx:set>
<tag attribute="$msg"/>
Would that make you dance on your desk? ;-)
-- Pierre
>From the JSPTL docs:
Setting the value of a JSP scoped attribute from the tag's body content
is useful to solve the problem associated with the fact that a tag
attribute's value cannot be set from a tag. In the past, a tag developer
would have to offer extra "attributes as tags" so the value of these attributes
could be set from other tags. For example:
<x:atag>
<x:att1><x:foo>mumbojumbo</x:foo></x:att1>
</x:atag>
With the <set> tag, this can be handled without requiring the extra <att1> tag.
<jx:set var="att1"><x:foo>mumbojumbo</x:foo></jx:set>
<x:atag att1="$att1"/>