You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2010/06/12 04:24:24 UTC

loop source property must have setter .. why?

Hi,

I tried to set my loop source as a bean property which has a private 
setter - as my implementation of this bean should not expose the setter 
for this field.

tapestry told me 'MyBean does not contain a property named myField'.

Adding public setter (in which i throw an exception) solved the tapestry 
issue, but why should a loop source need a setter?

Discuss.....

p.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: loop source property must have setter .. why?

Posted by Paul Stanton <pa...@mapshed.com.au>.
Ah i found the problem...

In my bean ReportRequest i also had a method with the same name that 
accepted a parameter. This must have been confusing BeanInfo.

public List<ReportLocation> getLocations(int group)

thanks for trying to reproduce it Josh.

p.

Josh Canfield wrote:
> Hmm.. I can't reproduce in 5.1.0.5.
>
> On Fri, Jun 11, 2010 at 8:43 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
>   
>> Hi Thiago,
>>
>> No, it doesn't work with
>> 1) no setter
>> 2) a private setter
>>
>> I can verify that reportRequest is non null when arriving at this page.
>>
>> Error message:
>>
>> Exception assembling root component of page MyPage: Could not convert
>> 'reportRequest.locations' into a component parameter binding: Class
>> package.ReportRequest does not contain a property named 'locations' (within
>> property expression 'reportRequest.locations'). Available properties:
>> otherProperties.
>>
>> public class MyPage
>> {
>> ...
>>   @SuppressWarnings("unused")
>>   @SessionState(create = false)
>>   @Property
>>   private ReportRequest reportRequest;
>>   @SuppressWarnings("unused")
>>   @Property
>>   private ReportLocation location;
>> ...
>> }
>>
>> public class ReportRequest
>> {
>> ...
>>   private List<ReportLocation> locations = new ArrayList<ReportLocation>();
>>
>>   public List<ReportLocation> getLocations()
>>   {
>>       return locations;
>>   }
>> ...
>> }
>>
>> MyPage.tml:
>> ...
>>       <tr t:type="Loop" source="reportRequest.locations" value="location">
>> ...
>>
>> Regards, Paul.
>>
>> Thiago H. de Paula Figueiredo wrote:
>>     
>>> On Fri, 11 Jun 2010 23:24:24 -0300, Paul Stanton <pa...@mapshed.com.au>
>>> wrote:
>>>
>>>       
>>>> Hi,
>>>>         
>>> Hi!
>>>
>>>       
>>>> I tried to set my loop source as a bean property which has a private
>>>> setter - as my implementation of this bean should not expose the setter for
>>>> this field.
>>>>
>>>> tapestry told me 'MyBean does not contain a property named myField'.
>>>>
>>>> Adding public setter (in which i throw an exception) solved the tapestry
>>>> issue, but why should a loop source need a setter?
>>>>         
>>> It doesn't. Maybe Tapestry was confused by the private setter. Please post
>>> your code so we can take a look at it.
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>
>   

Re: loop source property must have setter .. why?

Posted by Josh Canfield <jo...@gmail.com>.
Hmm.. I can't reproduce in 5.1.0.5.

On Fri, Jun 11, 2010 at 8:43 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
> Hi Thiago,
>
> No, it doesn't work with
> 1) no setter
> 2) a private setter
>
> I can verify that reportRequest is non null when arriving at this page.
>
> Error message:
>
> Exception assembling root component of page MyPage: Could not convert
> 'reportRequest.locations' into a component parameter binding: Class
> package.ReportRequest does not contain a property named 'locations' (within
> property expression 'reportRequest.locations'). Available properties:
> otherProperties.
>
> public class MyPage
> {
> ...
>   @SuppressWarnings("unused")
>   @SessionState(create = false)
>   @Property
>   private ReportRequest reportRequest;
>   @SuppressWarnings("unused")
>   @Property
>   private ReportLocation location;
> ...
> }
>
> public class ReportRequest
> {
> ...
>   private List<ReportLocation> locations = new ArrayList<ReportLocation>();
>
>   public List<ReportLocation> getLocations()
>   {
>       return locations;
>   }
> ...
> }
>
> MyPage.tml:
> ...
>       <tr t:type="Loop" source="reportRequest.locations" value="location">
> ...
>
> Regards, Paul.
>
> Thiago H. de Paula Figueiredo wrote:
>>
>> On Fri, 11 Jun 2010 23:24:24 -0300, Paul Stanton <pa...@mapshed.com.au>
>> wrote:
>>
>>> Hi,
>>
>> Hi!
>>
>>> I tried to set my loop source as a bean property which has a private
>>> setter - as my implementation of this bean should not expose the setter for
>>> this field.
>>>
>>> tapestry told me 'MyBean does not contain a property named myField'.
>>>
>>> Adding public setter (in which i throw an exception) solved the tapestry
>>> issue, but why should a loop source need a setter?
>>
>> It doesn't. Maybe Tapestry was confused by the private setter. Please post
>> your code so we can take a look at it.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: loop source property must have setter .. why?

Posted by Paul Stanton <pa...@mapshed.com.au>.
Hi Thiago,

No, it doesn't work with
1) no setter
2) a private setter

I can verify that reportRequest is non null when arriving at this page.

Error message:

Exception assembling root component of page MyPage: Could not convert 
'reportRequest.locations' into a component parameter binding: Class 
package.ReportRequest does not contain a property named 'locations' 
(within property expression 'reportRequest.locations'). Available 
properties: otherProperties.

public class MyPage
{
...
    @SuppressWarnings("unused")
    @SessionState(create = false)
    @Property
    private ReportRequest reportRequest;
    @SuppressWarnings("unused")
    @Property
    private ReportLocation location;
...
}

public class ReportRequest
{
...
    private List<ReportLocation> locations = new 
ArrayList<ReportLocation>();

    public List<ReportLocation> getLocations()
    {
        return locations;
    }
...
}

MyPage.tml:
...
        <tr t:type="Loop" source="reportRequest.locations" value="location">
...

Regards, Paul.

Thiago H. de Paula Figueiredo wrote:
> On Fri, 11 Jun 2010 23:24:24 -0300, Paul Stanton <pa...@mapshed.com.au> 
> wrote:
>
>> Hi,
>
> Hi!
>
>> I tried to set my loop source as a bean property which has a private 
>> setter - as my implementation of this bean should not expose the 
>> setter for this field.
>>
>> tapestry told me 'MyBean does not contain a property named myField'.
>>
>> Adding public setter (in which i throw an exception) solved the 
>> tapestry issue, but why should a loop source need a setter?
>
> It doesn't. Maybe Tapestry was confused by the private setter. Please 
> post your code so we can take a look at it.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: loop source property must have setter .. why?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 11 Jun 2010 23:24:24 -0300, Paul Stanton <pa...@mapshed.com.au>  
wrote:

> Hi,

Hi!

> I tried to set my loop source as a bean property which has a private  
> setter - as my implementation of this bean should not expose the setter  
> for this field.
>
> tapestry told me 'MyBean does not contain a property named myField'.
>
> Adding public setter (in which i throw an exception) solved the tapestry  
> issue, but why should a loop source need a setter?

It doesn't. Maybe Tapestry was confused by the private setter. Please post  
your code so we can take a look at it.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org