Wednesday, 15 February 2012

java - Apache Wicket : How to add PropertyModel to checkbox object -



java - Apache Wicket : How to add PropertyModel to checkbox object -

code follows

< input type="checkbox" wicket:id="dschk"/>

java

checkbox dschk = new checkbox("dschk");

i don't want utilize next constructor

checkbox dschk = new checkbox("dschk", new propertymodel(metacommenttechspeedbean, "dschk"));

instead want add together model via method

typically

dschk .add[.....< add together modedl>.................]

please help

you can use:

dschk.setdefaultmodel(new propertymodel(metacommenttechspeedbean, "dschk"));

or take compoundpropertymodel

then this

compoundpropertymodel<metacommenttechspeedbean> props = new compoundpropertymodel<metacommenttechspeedbean>(metacommenttechspeedbean); form<metacommenttechspeedbean> form = new form<metacommenttechspeedbean>("wicketid", props); checkbox dschk = new checkbox("dschk"); form.add(dschk); add(form);

the compoundpropertymodel set right propertymodel based on wicketid give checkbox object. in forms onsubmit() phone call can getmodelobject() metacommenttechspeedbean object.

java apache wicket wicket-1.5

No comments:

Post a Comment