Hehe, I knew there were some reason.. Just looked a bit odd. 2009/2/17 Jeremy Thomerson <jer...@wickettraining.com>
> Because there's a compile error if you don't "The method > error(IValidationError) is ambiguous for the type new > TextField<String>(){}". > > I thought the same, and didn't care to look further since this was just a > quick example. Take a look for yourself: > > new TextField<String>("", new Model<String>("")) { > private static final long serialVersionUID = 1L; > > public void updateModel() { > try { > super.updateModel(); > } catch(Exception ex) { > ValidationError error = new ValidationError(); > error.setMessage(ex.getMessage()); > /* or you could do this: > * error.addMessageKey("MaximumValidator"); > * error.setVariable("maximum", 1); > */ > error(error); > } > } > }; > > > On Tue, Feb 17, 2009 at 2:56 PM, Nino Martinez < > nino.martinez.w...@gmail.com > > wrote: > > > Jeremy Thomerson wrote: > > > >> I, too, agree that this may not be the best way of doing things. But, > >> anyway, there is a solution that will work: > >> > >> Use ValidationError rather than just a string > >> > >> public void updateModel() { > >> try { > >> super.updateModel(); > >> } catch(Exception ex) { > >> ValidationError error = new ValidationError(); > >> error.setMessage(ex.getMessage()); > >> /* or you could do this: > >> * error.addMessageKey("MaximumValidator"); > >> * error.setVariable("maximum", 1); > >> */ > >> error((IValidationError) error); > >> > >> > > why the cast? ValidationError implements IValidationError right? > > > > } > >> } > >> > >> > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > -- > Jeremy Thomerson > http://www.wickettraining.com >