You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Henry Chen <he...@gmail.com> on 2005/03/30 23:47:13 UTC
RE: PropertySelection with data from Spring + Hibernate
OK. It was solved after I recreated the component. This time your way
worked. Thanks.
Henry
-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Ron Piterman
Sent: Wednesday, March 30, 2005 3:07 PM
To: tapestry-user@jakarta.apache.org
Subject: Re: PropertySelection with data from Spring + Hibernate
????? Henry Chen:
> But the getModel() has to be static, getService() cannot be invoked in
> this static method, Any idea?
static ? why? no, it should be just as written below, a normal instance
method. The model member is also no static member.
>
> Henry
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Ron Piterman
> Sent: Wednesday, March 30, 2005 2:16 AM
> To: tapestry-user@jakarta.apache.org
> Subject: Re: PropertySelection with data from Spring + Hibernate
>
> ????? Henry Chen:
>
>>Hi,
>>
>>I've been struggling on this in the past two hours and still got no
>>way out. Help me please.
>>
>>Here is part of my .jwc:
>>............
>> <property-specification name="AutoService"
>> type="com.cam.auto.service.AutoManager">
>> page.global.appContext.getBean("AutoService")
>> </property-specification>
>>
>> <component id="manufacturerList" type="PropertySelection">
>> <binding name="value" expression="manufacturer"/>
>> <binding name="model" expression="manufacturerModel"/>
>> </component>
>>
>> <property-specification name="manufacturerModel"
>> type="org.apache.tapestry.form.IPropertySelectionModel"/>
>> <property-specification name="manufacturer"
>>type="java.lang.String"/> ...........
>>
>>And in the page object file I tried to initialize the propertyModel.
>>.......
>> public void finishLoad() {
>> List itemList =
>>getAutoService().getManufacturers(getPage().getLocale());
>> String[] items = (String[])itemList.toArray();
>> setManufacturerModel(new StringPropertySelectionModel(items));
>> }
>>........
>
> Forget the finishLoad()...
> try it like this:
>
>
> IPropertySelectionModel model;
>
> public IPropertySelectionModel getModel() {
> if (model == null) {
> // here comes your code...
> List itemList =
> getAutoService().
> getManufacturers(getPage().
> getLocale());
> String[] items = (String[])itemList.toArray();
> model = new StringPropertySelectionModel(items));
> }
> return model;
> }
>
> Thats it
>
>>But this produced an exception because getAutoService() returned null
>>value. Because the page properties hadn't been set yet. But I need to
>>set the model for component manufacturerList before the pageRender.
>>
>>Any ideas?
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org