Binding troubles

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Binding troubles

Bendik Rognlien Johansen-2
Hello,
I have an action bean with two private member variables:

private Company _company;
private Category _category;

Both fields have public getter/setter methods.


I request the action bean like this:
MyAction.action?edit=&company.id=70&category.id=99

Now, in the handler:
_company.id is 0
_category.id is 99

The only significant difference between Company and Category that I  
can think of, is that Company extends an abstract class.

Any suggestions?

Thanks!

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Binding troubles

Ben Gunter
Is the getter for _company getCompany()?
Is the setter for _company setCompany(Company c)?
Are both methods public?
Does Company define a public, no-arg constructor?
Does Company.setId(...) exist?
Is it public?

If any of the answers is no then you might have some trouble.

-Ben

Bendik Rognlien Johansen wrote:

> Hello,
> I have an action bean with two private member variables:
>
> private Company _company;
> private Category _category;
>
> Both fields have public getter/setter methods.
>
>
> I request the action bean like this:
> MyAction.action?edit=&company.id=70&category.id=99
>
> Now, in the handler:
> _company.id is 0
> _category.id is 99
>
> The only significant difference between Company and Category that I  
> can think of, is that Company extends an abstract class.
>
> Any suggestions?
>
> Thanks!
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>  

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Binding troubles

Bendik Rognlien Johansen-2
Thanks!
All the answers are yes.

The problem was Company.getId() returned Integer instead of int. (id  
is set with int: Company.setId(int id))

A little strange, I thought autoboxing/autounboxing would take care  
of it.

Sometimes all that is needed is for someone to point in the right  
direction :-)



On Oct 24, 2006, at 4:27 PM, Ben Gunter wrote:

> Is the getter for _company getCompany()?
> Is the setter for _company setCompany(Company c)?
> Are both methods public?
> Does Company define a public, no-arg constructor?
> Does Company.setId(...) exist?
> Is it public?
>
> If any of the answers is no then you might have some trouble.
>
> -Ben
>
> Bendik Rognlien Johansen wrote:
>> Hello,
>> I have an action bean with two private member variables:
>>
>> private Company _company;
>> private Category _category;
>>
>> Both fields have public getter/setter methods.
>>
>>
>> I request the action bean like this:
>> MyAction.action?edit=&company.id=70&category.id=99
>>
>> Now, in the handler:
>> _company.id is 0
>> _category.id is 99
>>
>> The only significant difference between Company and Category that I
>> can think of, is that Company extends an abstract class.
>>
>> Any suggestions?
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> ----
>> Using Tomcat but need to do more? Need to support web services,  
>> security?
>> Get stuff done quickly with pre-integrated technology to make your  
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
>> Geronimo
>> http://sel.as-us.falkag.net/sel?
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Stripes-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>
> ----------------------------------------------------------------------
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Binding troubles

Tim Fennell-3
Ah.  Autoboxing would indeed take care of that *if* the Introspector  
though of Id as a property.  But for the Introspector (part of the  
JavaBean implementation) to detect a property the get/set methods  
must have matching types if present....

-t

On Oct 24, 2006, at 10:50 AM, Bendik Rognlien Johansen wrote:

> Thanks!
> All the answers are yes.
>
> The problem was Company.getId() returned Integer instead of int. (id
> is set with int: Company.setId(int id))
>
> A little strange, I thought autoboxing/autounboxing would take care
> of it.
>
> Sometimes all that is needed is for someone to point in the right
> direction :-)
>
>
>
> On Oct 24, 2006, at 4:27 PM, Ben Gunter wrote:
>
>> Is the getter for _company getCompany()?
>> Is the setter for _company setCompany(Company c)?
>> Are both methods public?
>> Does Company define a public, no-arg constructor?
>> Does Company.setId(...) exist?
>> Is it public?
>>
>> If any of the answers is no then you might have some trouble.
>>
>> -Ben
>>
>> Bendik Rognlien Johansen wrote:
>>> Hello,
>>> I have an action bean with two private member variables:
>>>
>>> private Company _company;
>>> private Category _category;
>>>
>>> Both fields have public getter/setter methods.
>>>
>>>
>>> I request the action bean like this:
>>> MyAction.action?edit=&company.id=70&category.id=99
>>>
>>> Now, in the handler:
>>> _company.id is 0
>>> _category.id is 99
>>>
>>> The only significant difference between Company and Category that I
>>> can think of, is that Company extends an abstract class.
>>>
>>> Any suggestions?
>>>
>>> Thanks!
>>>
>>> --------------------------------------------------------------------
>>> -
>>> ----
>>> Using Tomcat but need to do more? Need to support web services,
>>> security?
>>> Get stuff done quickly with pre-integrated technology to make your
>>> job easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>>> Geronimo
>>> http://sel.as-us.falkag.net/sel?
>>> cmd=lnk&kid=120709&bid=263057&dat=121642
>>> _______________________________________________
>>> Stripes-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>>
>>
>> ---------------------------------------------------------------------
>> -
>> ---
>> Using Tomcat but need to do more? Need to support web services,
>> security?
>> Get stuff done quickly with pre-integrated technology to make your
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Stripes-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ----------------------------------------------------------------------
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Binding troubles

John W Newman
In reply to this post by Ben Gunter
Ben Gunter <bgunter@...> writes:

>
> Is the getter for _company getCompany()?
> Is the setter for _company setCompany(Company c)?

it wouldn't have something to do with the _ would it?  I don't understand why
people use that.  Try dropping that and using just letters for your identifiers.

i don't understand that reason behind that convention, i wish the _ was illegal

int _;
int __;
int $;
int $_;


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Binding troubles

David G Friedman
$ and $_ ? I gave that up when I left PERL to program websites in Java years
ago. I Are we changing the name from Stripes to StriPERLs now? :)

-David, yeah, witty banter didn't really go with that post, did it?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of John
Newman
Sent: Tuesday, October 24, 2006 6:09 PM
To: [hidden email]
Subject: Re: [Stripes-users] Binding troubles


Ben Gunter <bgunter@...> writes:

>
> Is the getter for _company getCompany()?
> Is the setter for _company setCompany(Company c)?

it wouldn't have something to do with the _ would it?  I don't understand
why
people use that.  Try dropping that and using just letters for your
identifiers.

i don't understand that reason behind that convention, i wish the _ was
illegal

int _;
int __;
int $;
int $_;


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users