tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "???" <bp95...@narae.kangwon.ac.kr>
Subject Re: Help with nested beans.
Date Thu, 18 May 2000 10:43:38 GMT

----- Original Message ----- 
From: "Jay Herrick" <Jay.Herrick@XOR.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Tuesday, May 16, 2000 3:58 AM
Subject: Help with nested beans.


> Hey there,
> 
> I need to know if I can use nested beans in the context of JSP.
> 
> For example:
> 
> If I have a bean 'Foo' that keeps a refence to another bean 'Bar' that 
> has a property 'name'.  Can I do something like:
> 
> <jsp:useBean name="myFoo" scope="request" class="Foo" />
> <jsp:getProperty name="myFoo" property="bar.name" />
> 
> Of course 'Foo' has a 'Foo getBar()' method and 'Bar' has a 'String 
> getName()' method?
> 
> 
> I've tried the obove syntax and it didn't work.  So I guess I should 
> be asking is it possible, AND what is the syntax.
> 
> Thanks,
> 
> Jay Herrick
> XOR Inc.
> 
> 
> 
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
> 
> 

action tag syntax is 
<jsp:useBean id="name" class="beanName" scope="[page|request|session|application]" />
and
<jsp:getProperty name="name" property="propertyName" / >

so your code must be changed like this

<jsp:useBean id="myFoo" scope="request" class="Foo" />
<jsp:getProperty name="myFoo" property="bar.name" />



Mime
View raw message