Ok, I've defined convert() and added my converter to the default one but now I get this exception:
ognl.OgnlException: email [java.lang.ClassCastException: [Ljavax.mail.internet.InternetAddress;]
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:84)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1629)
at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:180)
at ognl.SimpleNode.setValue(SimpleNode.java:249)
at ognl.Ognl.setValue(Ognl.java:476)
at ognl.Ognl.setValue(Ognl.java:494)
at wicket.model.AbstractPropertyModel.onSetObject(AbstractPropertyModel.java:184)
The model contains this method:
public void setEmail(InternetAddress value)
The Form contains this constructor:
public SubscriptionForm(String name, IFeedback feedback) { super(name, feedback);
BoundCompoundPropertyModel model = new BoundCompoundPropertyModel(new SubscriptionModel());
setModel(model);
Converter converter = (Converter) getConverter();
converter.set(InternetAddress.class, new InternetAddressConverter());
RequiredTextField email = new RequiredTextField("email", InternetAddress.class);
add(email);
model.bind(email, InternetAddress.class); add(new Button("submit")); }
Ideas?
Gili
Gili wrote:
Hi,
I need help with Wicket converters. I took a quick glance at AbstractConverter and it does not define:
Object convert(Object value, Locale locale)
which is defined by subclasses. This is confusing to me because I want to define a InternetAddressConverter which will ensure that a String field in the form is actually a valid email address. It is unclear to me what I need to do to get this to work. Any tips would be appreciated.
Gili
------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user