struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bhaarat Sharma" <>
Subject <s:checkbox> preselect
Date Wed, 12 Dec 2007 20:53:27 GMT

I have a form with multiple checkboxes. this form is submitted to the
action class and some validation is done in the action class (not
using annotations). when validation fails the control comes back to
the same page with some error messages.

However, the problem is that when the control comes back..all
checkboxes are unchecked (even the ones user had selected).

small example of my problem:
  <s:checkbox label=\"checkbox test\" name=\"checkboxField1\"
fieldValue=\"something\" />

my getters and setters:
    public String getCheckboxField1() {
        return checkboxField1;

    public void setCheckboxField1(String checkboxField1) {
        this.checkboxField1 = checkboxField1;

if this checkbox was checked initially, when the control comes back to
this form ..this check box is not selected now.

I\'ve tried many different things and only time it seems to work is
when my tag is like this
  <s:checkbox label=\"checkbox test\" name=\"checkboxField1\"
fieldValue=\"true\" />

but if i put anything else in fieldValue attribute then it fails.  Are
we not allowed to have anything else other than true or false in
fieldValue ??

I need the html checkbox value to be something other than just true or
false as my action is expecting that.

I read the documentation and it says \'value\' is used for
preselecting checkbox field but even that doesnt work.

I\'d appreciate any help please


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message