java - Wicket TextField with default value -
what elegant way create textfield in wicket rendered default value besides manually setting "value" attribute of component using simpleattributemodifier?
for instance, works:
textfield<string> headline = new textfield<string>("headline", new propertymodel(backingobject, "headline")); headline.add(new simpleattributemodifier("value", "default value")); add(headline);
but there better way?
propertymodel
works both ways. instead of using attribute modifier, change headline so:
backingobject.setheadline("[desired initial text]");
you can anywhere, doesn't have after textfield
declaration. of course, if don't want touch backingobject
beforehand, won't work, i'm going assume that's not issue since didn't mention it.
Comments
Post a Comment