| Author |
get/set for Date fields using Apache Beanutils
|
Pat Farrell
Rancher
Joined: Aug 11, 2007
Posts: 4422
|
|
I'm using the Apache Beanutils code to populate my Bean's fields, and it works great for String valued fields.
But I can't figure out how to use it for the Date type fields.
Google shows links to something called DateLocaleConverter
but I can't find any examples of how it is used.
My code uses Beanutils with:
rMap = ctx.getRequest().getParameterMap();
BeanUtils.populate(this, rMap);
I have no idea what to do to work with a Date field such as
private Date dueDate;
public void setDueDate(xxx);
public xxx getDueDate();
Pointers greatly appreciated.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56223
|
|
Heh heh... adding something to FrontMan 2.0 along these lines.
Here's a sneak peek. It's a work in progress so it's still rough around the edge.
Taken from a class that will do automatic param processing....
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Pat Farrell
Rancher
Joined: Aug 11, 2007
Posts: 4422
|
|
Bear Bibeault wrote:Heh heh... adding something to FrontMan 2.0 along these lines
So when will 2.0 be ready for beta testing?
And until then, what do I do to debug it.
I'm getting:
java.lang.IllegalArgumentException: Cannot convert 02/13/10 12:00 AM of type class java.lang.String to class java.util.Date
which makes no sense, as it is in the display of a JSP. The date is properly converted to a String, yet Beanutils seems to be trying to re-convert it to Date
I can't see where from the stackdump
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56223
|
|
Pat Farrell wrote:So when will 2.0 be ready for beta testing?
Front Man 2.0 is unfortunately on hold until I finish writing the 2nd edition of jQuery in Action. I'm way behind schedule -- I keep expecting the publisher to send Guido down to break my kneecaps.
Where's that coming from? All exceptions should be eaten and it'll just return null if anything boofs up. At least that's the intent... as I said, not well tested yet!
So in a sense, you are already beta testing.
|
 |
Pat Farrell
Rancher
Joined: Aug 11, 2007
Posts: 4422
|
|
Bear Bibeault wrote:I keep expecting the publisher to send Guido down to break my kneecaps
That's Uncle Guido for you.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56223
|
|
|
 |
 |
|
|
subject: get/set for Date fields using Apache Beanutils
|
|
|