You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Harden ZHU <hz...@gmail.com> on 2008/10/22 09:50:37 UTC

s2 Checkbox problem

I have a checkbox in jsp:

<s:checkbox name="user.contactConfidential" fieldValue="Y" />,
after html rendering it is shown as <input type="checkbox"
name="user.contactConfidential" value="Y"
id="user.contactConfidential"/>, that is good.

But once a user selects the checkbox and submits the form,
user.contactConfidential is set to true. However, on the database side
the value should be stored as 'Y' or 'N'.  Is there anyway that I can
get  user.contactConfidential="Y" when submits form instead of
true/false?

Thanks

Harden

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: s2 Checkbox problem

Posted by Mead Lai <la...@gmail.com>.
in the Action, you need a list;
List<String> checklist;//getter & setter
then, you can get the fieldValue="Y" in the struts tag, from field
"checklist" in the Action.
 and the value is the same value in html tag value="Y".


On Wed, Oct 22, 2008 at 3:50 PM, Harden ZHU <hz...@gmail.com> wrote:

> I have a checkbox in jsp:
>
> <s:checkbox name="user.contactConfidential" fieldValue="Y" />,
> after html rendering it is shown as <input type="checkbox"
> name="user.contactConfidential" value="Y"
> id="user.contactConfidential"/>, that is good.
>
> But once a user selects the checkbox and submits the form,
> user.contactConfidential is set to true. However, on the database side
> the value should be stored as 'Y' or 'N'.  Is there anyway that I can
> get  user.contactConfidential="Y" when submits form instead of
> true/false?
>
> Thanks
>
> Harden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
BestRegards,
Mead
http://yayisoft.com

George Burns  - "When I was a boy the Dead Sea was only sick."