You are missing my point! If I just could set the checkbox value to
false in the reset method, everything is fine. But there are times when
that value has to be reset to true and not false and if I do that in my
reset method, I am not able to see of the user unchek the checkbox,
because the boolean variable is still true after the form has been
posted!


BTJ

On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> [EMAIL PROTECTED]
> 
> | Yes, but to clarify...
> | I am showing a jsp page with values read from a database. If the
> | checkbox value is true, how do I then make the checkbox on my jsp-page
> | checked and how do I then find out if the checkbox has been unchecked?
> | Do I have to manually read the posted data and see if the checkbox
> | attribute is missing or is there a better way?
> 
> I assume that you are using an Action with an ActionForm.
> 
> To make the value of the checkbox come up correctly, import
> struts tags into your jsp-page: 
> 
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> 
> Then use the Struts checkbox tag:
> 
> <strh:checkbox property="done"/>
> 
> Assuming that your form has the methods getDone and setDone,
> these methods will be used to render the value of the checkbox
> correctly.
> 
> As to the question of boolean values that are set to false by the
> user: You don't have to parse the posted data manually.  The
> method reset() in ActionForm is run before the posted data is
> used to populate the form.  Write your own reset() method where
> you set the boolean fields to false.
-- 
-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]                  Havleik Consulting
Phone : +47 67 54 15 17         Conradisvei 4
Fax : +47 67 54 13 91           N-1338 Sandvika
Cellular : +47 926 93 298       http://www.havleik.no
-----------------------------------------------------------------------------------------------
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
-----------------------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to