You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Grzegorz Stasica <gs...@poczta.onet.pl> on 2005/05/19 21:15:17 UTC

jstl - define bean

I thought <c:set ...> defines a new bean in page scope. If this is true 
I do not understand why attached code keeps throwing exception that no 
getB() is not defined.

<c:set property="b" value="kicha" var="d"></c:set>
<html:link forward="gtLogin" paramId="ddd" paramName="d" 
paramProperty="b">Login</html:link>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jstl - define bean

Posted by Martin Gainty <mg...@hotmail.com>.
Grzegorz-
Yes - Unless otherwise specified you are correct in stating the default
scope for the bean is 'page'
Martin-

----- Original Message -----
From: "Laurie Harper" <la...@holoweb.net>
To: <us...@struts.apache.org>
Sent: Thursday, May 19, 2005 11:22 PM
Subject: Re: jstl - define bean


> Grzegorz Stasica wrote:
>
> > I thought <c:set ...> defines a new bean in page scope. If this is true
>
> No, c:set sets a property on a bean that is already defined.
>
> > I do not understand why attached code keeps throwing exception that no
> > getB() is not defined.
> >
> > <c:set property="b" value="kicha" var="d"></c:set>
>
> This is equivalent to <% d.setB("kicha"); %>
>
> > <html:link forward="gtLogin" paramId="ddd" paramName="d"
> > paramProperty="b">Login</html:link>
>
> You're telling the html:link tag to create a parameter named 'ddd' whose
> value is taken from the property B of bean d. In other words, you're
> telling it to add a parameter whose value is d.getB(). If d's type
> doesn't define the accessor properly, Struts won't be able to call it.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jstl - define bean

Posted by Laurie Harper <la...@holoweb.net>.
Grzegorz Stasica wrote:

> I thought <c:set ...> defines a new bean in page scope. If this is true 

No, c:set sets a property on a bean that is already defined.

> I do not understand why attached code keeps throwing exception that no 
> getB() is not defined.
> 
> <c:set property="b" value="kicha" var="d"></c:set>

This is equivalent to <% d.setB("kicha"); %>

> <html:link forward="gtLogin" paramId="ddd" paramName="d" 
> paramProperty="b">Login</html:link>

You're telling the html:link tag to create a parameter named 'ddd' whose 
value is taken from the property B of bean d. In other words, you're 
telling it to add a parameter whose value is d.getB(). If d's type 
doesn't define the accessor properly, Struts won't be able to call it.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org