this is a completely wrong way of looking at it.

the component controls its own properties in markup and in java.

so under what condition is the checkbox checked? when its model object equals Boolean.TRUE, so all you have to do is make sure that the model object of the checkbox returns true when it renders and the checkbox will be set. you do not need to know or worry about the "checked" property of the checkbox, you need to worry about wiring it up through some model to a property that can either be true or false

-igor


On 11/9/06, Carfield Yim <[EMAIL PROTECTED]> wrote:
Yes, but what I need is the checkbox pre-set checked or not checked
according to  direction, I would like to have the HTML checkbox at the
form checked if the property is true, and the HTML checkbox unchecked
if the preperty is false.

Which, should be same as having HTML template like

<input type=checkbox <span wicket:id="property_checked"></span>
wicket:id="checkbox">

For java code

Foo foo = new Foo();
add(new CheckBox("checkbox", new PropertyModel(foo, "toBeOrNotToBe"));
add(new Label("property_checked"), foo.toBeOrNotToBe ? "checked":"");

However, you know, that is not working...

On 11/9/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> public class Foo {
>     public boolean toBeOrNotToBe = true;
> }
>
> Foo foo = new Foo();
> add(new CheckBox("checkbox", new PropertyModel(foo, "toBeOrNotToBe"));
>
> So, you don't have to set anything... the checkbox is checked, and
> when unchecked, the toBeOrNotToBe property of Foo will be set to
> false.
>
> Martijn
>
> On 11/9/06, Carfield Yim <[EMAIL PROTECTED]> wrote:
> > Can I set checkbox to be checked if the related java bean property is true?
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> --
> <a href="" href="http://www.thebeststuffintheworld.com/vote_for/wicket">http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> for <a href="" href="http://www.thebeststuffintheworld.com/stuff/wicket"> http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
> at the <a href="" href="http://www.thebeststuffintheworld.com/">http://www.thebeststuffintheworld.com/">Best Stuff in
> the World!</a>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to