Never done it myself, and don't know if it is a better way to do it, but:
protected IConverterLocator
{
return new ConverterLocator();
}
can be overriden to return your own converter locator and... plug there a
default converter (for Strings?) that will trim strings...
If you want to do this for a particular kind of component, e.g. textareas,
another possibility would be to use a component instantiation listener and
wrap the component model with a trimming model, e.g.
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
public class TrimmingModel extends Model<String> {
private static final long serialVersionUID = 1L;
private IModel<String> model;
public TrimmingModel(IModel<String> model) {
this.model = model;
}
@Override
public void setObject(String object) {
if(object != null)
this.model.setObject(object.trim());
this.model.setObject(object);
}
@Override
public String getObject() {
return this.model.getObject();
}
}
Best,
Ernesto
On Fri, Oct 2, 2009 at 5:24 AM, David Chang <[email protected]> wrote:
> How to set it up in a Wicket application? I would like to set it up in the
> application level.
>
> Thanks!
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>