BeanUtils.populate with non-lowercase property names.

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

BeanUtils.populate with non-lowercase property names.

Jason Cipriani
When using BeanUtils.populate() to populate a bean from
HttpServletRequest.getParameterMap(), is there a way to make it
recognize parameters with capital letters in their names, e.g. in the
query string "?SomeName=value&AnotherName=value"?

I've tried making a bean with both setSomename/getSomename and
setSomeName/getSomeName, but neither of those worked, and the property
was not set. What would the name of the setters/getters in the bean
have to be?

Thanks,
Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: BeanUtils.populate with non-lowercase property names.

ahardy66
Jason Cipriani on 25/03/09 04:10, wrote:
> When using BeanUtils.populate() to populate a bean from
> HttpServletRequest.getParameterMap(), is there a way to make it
> recognize parameters with capital letters in their names, e.g. in the
> query string "?SomeName=value&AnotherName=value"?
>
> I've tried making a bean with both setSomename/getSomename and
> setSomeName/getSomeName, but neither of those worked, and the property
> was not set. What would the name of the setters/getters in the bean
> have to be?

if BeanUtils relies on PropertyDescriptors

http://java.sun.com/javase/6/docs/api/java/beans/PropertyDescriptor.html

then it's not going to work since it doesn't adhere to the JavaBean standard. If
you're willing to spend the time, you can force it by writing BeanInfo classes.

Regards
Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]