You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Campbell <ug...@unixgeek.com> on 2001/02/08 01:01:40 UTC

Re: bean tag parameter confusion

>>>>> "CM" == Craig R McClanahan <Cr...@eng.sun.com> writes:


CM> When you say you want to "get at" that bean, what is it exactly
CM> that you wish to do? For example, if all you want to do is render
CM> the value of the bean (or a property of the bean) to the output
CM> page, you should use <bean:write> instead of <bean:define>.

Ah, yes, I see.  I thought I had to "reference" the bean to make it
visible somehow to the <bean:write> tag before I could use that.  

CM> In <bean:define>, the "id" attribute tells you the name of the attribute
CM> (and scripting variable) that will be *created* by this tag -- exactly
CM> the same as the "id" attribute on the standard <jsp:useBean> tag works.
CM> The "name" attribute, on the other hand, is the bean *from* which you
CM> are copying the value to be created.


I see now why when I was using <bean:define>, my example could use
<bean:write name="_" property="foo" /> with "_" being the value of
either the "id" or "name" parameter of the <bean:define> call; I was
creating a copy of my action class inserted bean so the <bean:write>
was rendering the property of either the original or the copied bean.

--