As long as you use the Stripes <s:checkbox> tag Stripes knows whether or not the boolean should be set. It stores the fields that are included in the <s:form> in the __fp hidden field. Because of this, when the checkbox parameter is entirely missing because it is not checked Stripes still knows and should act accordingly.

Aaron

Mike McNally wrote:
That seems like reasonable behavior to me. The workings of checkbox inputs can be very annoying for some programming models, including simple CRUD interfaces. If a model object has a boolean property, it'd be nice for there to be a way to make sure that the server always gets an explicit value for the checkbox. In another UI framework that problem grew to annoy me so much that I added a tag that marries a checkbox to a hidden input field. The checkbox serves no other purpose than to drive client-side code to update the hidden field.

In the case of a lower-case-"b" boolean property, the framework doesn't really have a way to tell you that no value was received for that input field; or, more correctly, it has no way to distinguish between an explicit "false" and a "nothing supplied" false.


On Mon, Nov 17, 2008 at 1:58 PM, Nathan Maves <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    So I am a bit confused on the use of a checkbox with a Boolean
    attribute.

    >From the taglib docs...

    "When the value attribute is omitted, as above, the checkbox defaults
    to the simple behaviour of sending "true" to the server when checked
    and nothing to the server when unchecked. For this reason it is best
    to use boolean values, or Boolean values initialized to
    Boolean.FALSE."

    In my action I have a custom domain object with a Boolean attribute
    contained in it.  When the chekbox is not selcted the value of the
    field is set to Null.  In the default constructor of my domain object
    I initialized the Boolean field to Boolean.FALSE.

    Everything work fine if I use boolean instead of Boolean.  What more
    am I expected to "initialize" when using a Boolean or is this a bug?

    Nathan

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's
    challenge
    Build the coolest Linux based applications with Moblin SDK & win
    great prizes
    Grand prize is a trip for two to an Open Source event anywhere in
    the world
    http://moblin-contest.org/redirect.php?banner_id=100&url=/
    <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
    _______________________________________________
    Stripes-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to