You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chuck Stern <cs...@safenetconsulting.com> on 2001/06/11 19:46:56 UTC

Help with define tag

Hi,

I think I'm missing something here.  I have a bean that is available to my
page in the request scope.  Within that I have another bean that has
properties I want to display.  I'm trying to use the define tag to get a
reference to the embedded bean and I'm getting the infamous:
javax.servlet.jsp.JspException: No getter method for property homeAddress of
bean policyHolderInfo

Here's the code -
In my bean policyHolderInfo bean attached to the request obj:

public AddressInfo homeAddress;

public AddressInfo
getHomeAddress(AddressInfo homeAddress)
{
    return homeAddress;
}

public void
setHomeAddress( AddressInfo homeAddress)
{
    this.homeAddress = homeAddress;
}

My jsp tag is:
<bean:define id="policyHolderAddress" name="policyHolderInfo"
property="homeAddress" />

All other getters on the policyHolderInfo bean work just fine.

Am I doing something wrong or is there another way to do this?  Any
suggestions would be appreciated.
Thanks,
Chuck

Re: Help with define tag

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Chuck,

comments below...

Monday, June 11, 2001, 9:46:56 PM, you wrote:

CS> Hi,

CS> I think I'm missing something here.  I have a bean that is available to my
CS> page in the request scope.  Within that I have another bean that has
CS> properties I want to display.  I'm trying to use the define tag to get a
CS> reference to the embedded bean and I'm getting the infamous:
CS> javax.servlet.jsp.JspException: No getter method for property homeAddress of
CS> bean policyHolderInfo

CS> Here's the code -
CS> In my bean policyHolderInfo bean attached to the request obj:

CS> public AddressInfo homeAddress;

CS> public AddressInfo
CS> getHomeAddress(AddressInfo homeAddress)

wrong here        ^^^^^^^^^^^^^^^^^^^^^^^^^

CS> {
CS>     return homeAddress;
CS> }

CS> public void
CS> setHomeAddress( AddressInfo homeAddress)
CS> {
CS>     this.homeAddress = homeAddress;
CS> }

CS> My jsp tag is:
CS> <bean:define id="policyHolderAddress" name="policyHolderInfo"
CS> property="homeAddress" />

CS> All other getters on the policyHolderInfo bean work just fine.

CS> Am I doing something wrong or is there another way to do this?  Any
CS> suggestions would be appreciated.
CS> Thanks,
CS> Chuck

Your property support must looks like -

public AddressInfo
getHomeAddress()
{
    return homeAddress;
}

public void
setHomeAddress( AddressInfo homeAddress)
{
    this.homeAddress = homeAddress;
}


-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re: Help with define tag

Posted by Martin Cooper <ma...@tumbleweed.com>.
Is your getter method really as you posted it? That just returns the 
parameter it is passed. It should be this:

public AddressInfo getHomeAddress()
{
     return this.homeAddress;
}

Note the absence of the parameter. The rest looks fine, although I would 
advocate making the homeAddress member private instead of public.

--
Martin Cooper


At 10:46 AM 6/11/01, Chuck Stern wrote:
>Hi,
>
>I think I'm missing something here.  I have a bean that is available to my
>page in the request scope.  Within that I have another bean that has
>properties I want to display.  I'm trying to use the define tag to get a
>reference to the embedded bean and I'm getting the infamous:
>javax.servlet.jsp.JspException: No getter method for property homeAddress of
>bean policyHolderInfo
>
>Here's the code -
>In my bean policyHolderInfo bean attached to the request obj:
>
>public AddressInfo homeAddress;
>
>public AddressInfo
>getHomeAddress(AddressInfo homeAddress)
>{
>     return homeAddress;
>}
>
>public void
>setHomeAddress( AddressInfo homeAddress)
>{
>     this.homeAddress = homeAddress;
>}
>
>My jsp tag is:
><bean:define id="policyHolderAddress" name="policyHolderInfo"
>property="homeAddress" />
>
>All other getters on the policyHolderInfo bean work just fine.
>
>Am I doing something wrong or is there another way to do this?  Any
>suggestions would be appreciated.
>Thanks,
>Chuck