You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nino Walker <ni...@xtime.com> on 2001/07/17 20:40:32 UTC
Embedded bean/param values
Hi,
I've noticed a number of postings asking about syntax using embedded
tags, a la: <tag attribute="<bean:write bean="..." property="..." />
.../>
It's clear that this is not supported, but has anyone implemented a
different solution to address this?
I'm coming form the world of ATG/JHTML, where they support syntax like:
<tag attribute="bean:BeanName.property"> and <tag
attribute="param:ParamName">
This has been very convenient, and I'm curious if there are solutions
existing, or on the horizon, that solve this problem.
Thanks,
Nino
Re: Embedded bean/param values
Posted by Pierre Delisle <pi...@sun.com>.
"Craig R. McClanahan" wrote:
>
> On Tue, 17 Jul 2001, Nino Walker wrote:
>
> > Hi,
> >
> > I've noticed a number of postings asking about syntax using embedded
> > tags, a la: <tag attribute="<bean:write bean="..." property="..." />
> > .../>
> >
> > It's clear that this is not supported, but has anyone implemented a
> > different solution to address this?
> >
>
> In case people aren't aware, it's a restriction in the JSP spec ... and,
> the ultimate reason is that it's invalid XML syntax as well.
>
> > I'm coming form the world of ATG/JHTML, where they support syntax like:
> > <tag attribute="bean:BeanName.property"> and <tag
> > attribute="param:ParamName">
> >
>
> The standard approach to this requirment in JSP is to use runtime
> expressions. Where you might want to write
>
> <tag attribute="<bean:write name="foo" property="bar.baz"/>" />
>
> you can write this instead:
>
> <jsp:useBean id="foo" class="..." scope="..."/>
> <tag attribute="<%= foo.getBar().getBaz() %>" />
>
> > This has been very convenient, and I'm curious if there are solutions
> > existing, or on the horizon, that solve this problem.
Yes. Have a look at JSPTL
(http://jakarta.apache.org/taglibs/doc/jsptl-doc/jsptl-ea1/index.html).
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"/>
-- Pierre
> >
> > Thanks,
> >
> > Nino
> >
> >
>
> Craig
Re: Embedded bean/param values
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Tue, 17 Jul 2001, Nino Walker wrote:
> Hi,
>
> I've noticed a number of postings asking about syntax using embedded
> tags, a la: <tag attribute="<bean:write bean="..." property="..." />
> .../>
>
> It's clear that this is not supported, but has anyone implemented a
> different solution to address this?
>
In case people aren't aware, it's a restriction in the JSP spec ... and,
the ultimate reason is that it's invalid XML syntax as well.
> I'm coming form the world of ATG/JHTML, where they support syntax like:
> <tag attribute="bean:BeanName.property"> and <tag
> attribute="param:ParamName">
>
The standard approach to this requirment in JSP is to use runtime
expressions. Where you might want to write
<tag attribute="<bean:write name="foo" property="bar.baz"/>" />
you can write this instead:
<jsp:useBean id="foo" class="..." scope="..."/>
<tag attribute="<%= foo.getBar().getBaz() %>" />
> This has been very convenient, and I'm curious if there are solutions
> existing, or on the horizon, that solve this problem.
>
> Thanks,
>
> Nino
>
>
Craig