You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Derek Clarkson <dc...@waterwerks.com.au> on 2003/12/09 03:54:07 UTC

Setting bean properties question

Hi all,
	I want to set a property of a bean to a value in the jsp document. I've tried 
using 

<c:set target="mybean" property="myProperty" value="${avalue}" />

But it will throw errors unless I change it to:

<c:set var="x" target="mybean" property="myProperty" value="${avalue}" />

I can't see why I need to set a page context variable in order to set a 
property. In addition, what if I want to set a property on a bean which is in 
page scope. Should I do something like:

<c:set var="mybean" target="mybean" property="myProperty" value="${avalue}" />

And if so, will it use the already present bean or wipe it and create another 
?

Any comments much appreciated.


-- 
Regards,
Derek Clarkson

.O. Analyst/Programmer
..O Waterwerks Pty Ltd
OOO Melbourne, Australia


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


Re: Setting bean properties question

Posted by Derek Clarkson <dc...@waterwerks.com.au>.
Thanks for that. It worked. 
cio
Derek

On Tuesday 09 December 2003 14:07, Kris Schneider wrote:
> <c:set target="${mybean}" property="myProperty" value="${avalue}"/>
>
> Derek Clarkson wrote:
> > Hi all,
> > 	I want to set a property of a bean to a value in the jsp document. I've
> > tried using
> >
> > <c:set target="mybean" property="myProperty" value="${avalue}" />
> >
> > But it will throw errors unless I change it to:
> >
> > <c:set var="x" target="mybean" property="myProperty" value="${avalue}" />
> >
> > I can't see why I need to set a page context variable in order to set a
> > property. In addition, what if I want to set a property on a bean which
> > is in page scope. Should I do something like:
> >
> > <c:set var="mybean" target="mybean" property="myProperty"
> > value="${avalue}" />
> >
> > And if so, will it use the already present bean or wipe it and create
> > another ?
> >
> > Any comments much appreciated.

-- 
Regards,
Derek Clarkson

.O. Analyst/Programmer
..O Waterwerks Pty Ltd
OOO Melbourne, Australia


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


Re: Setting bean properties question

Posted by Kris Schneider <kr...@dotech.com>.
<c:set target="${mybean}" property="myProperty" value="${avalue}"/>

Derek Clarkson wrote:
> Hi all,
> 	I want to set a property of a bean to a value in the jsp document. I've tried 
> using 
> 
> <c:set target="mybean" property="myProperty" value="${avalue}" />
> 
> But it will throw errors unless I change it to:
> 
> <c:set var="x" target="mybean" property="myProperty" value="${avalue}" />
> 
> I can't see why I need to set a page context variable in order to set a 
> property. In addition, what if I want to set a property on a bean which is in 
> page scope. Should I do something like:
> 
> <c:set var="mybean" target="mybean" property="myProperty" value="${avalue}" />
> 
> And if so, will it use the already present bean or wipe it and create another 
> ?
> 
> Any comments much appreciated.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>



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