PDA

View Full Version : How to create property editor


ksriram
May 19th, 2007, 07:45 AM
How to create a property editor for options tag ?

noon
May 19th, 2007, 09:24 AM
Spring reference manual has a great chapter of this and I'm sure you can find some great examples from the net.

http://www.springframework.org/docs/reference/validation.html

Jörg Heinicke
May 19th, 2007, 11:12 AM
The general idea:

Let your custom property editor extend PropertyEditorSupport.
Implement the both methods getAsText() and setAsText(String):

In getAsText() call getValue() first, which returns the actual object. Return a string representation of this object.
In setAsText(String) the parameter is a string representation of your object. Convert it back to an object. Call setValue(Object) with that object as parameter.



Jörg

len53
May 19th, 2007, 12:20 PM
After property editor is created how we can bind it ?

Ihave in mind speific property editor, namely StringArrayPropertyEditor. I opened a "StringArrayPropertyEditor usage " thread a few days ago, but nobody has responded.

May be i can get clarification on that in this thread ?