You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steven Sajous <st...@dotmarketing.com> on 2003/05/07 23:32:53 UTC

Booleans in form beans

I thought I read somewhere that I could use a boolean in my form bean for
checkboxes, cannot remember where I saw that. Anyone has any idea?


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


RE: Booleans in form beans

Posted by Kris Schneider <kr...@dotech.com>.
Who said anything about HTTP? You said, "All FormBean methods accept and return
Strings only". That's just not true, regardless of how information is actually
communicated via HTTP. Using a boolean form bean property for checkboxes has
been the recommended practice since 1.0.

Quoting Mark Galbreath <ma...@qat.com>:

> The fact is, the only thing that can be passed via HTTP is a String, no
> matter what the underlying property type may be.
> 
> Mark
> 
> -----Original Message-----
> From: Kris Schneider [mailto:kris@dotech.com] 
> Sent: Thursday, May 08, 2003 10:23 AM
> To: Struts Users Mailing List
> Subject: RE: Booleans in form beans
> 
> 
> Well, "All" and "only" are a bit strong. Ignoring booleans, it's perfectly
> fine for a form bean to have nested, indexed, and mapped properties. As for
> checkboxes, boolean properties are actually the recommended way to go:
> 
> http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox
> 
> Quoting Mark Galbreath <ma...@qat.com>:
> 
> > All FormBean methods accept and return Strings only.  You can do type 
> > conversions, however, for use in a related Action.  Checkboxes return 
> > the value you specify on the form or "ON" by default.  The only way 
> > you can see if a checkbox has been checked is to initialize the 
> > FormBean property to "false" and be sure to reset it to "false" in 
> > reset();
> > 
> > Mark
> > 
> > -----Original Message-----
> > From: Steven Sajous [mailto:steve@dotmarketing.com]
> > Sent: Wednesday, May 07, 2003 5:33 PM
> > To: Struts Users Mailing List
> > Subject: Booleans in form beans
> > 
> > 
> > I thought I read somewhere that I could use a boolean in my form bean 
> > for checkboxes, cannot remember where I saw that. Anyone has any idea?
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


RE: Booleans in form beans

Posted by Mike Jasnowski <mj...@bea.com>.
Though I think the BooleanConverter is part of the commons package

-----Original Message-----
From: Mike Jasnowski [mailto:mjasnows@bea.com]
Sent: Thursday, May 08, 2003 10:33 AM
To: Struts Users Mailing List
Subject: RE: Booleans in form beans


we use booleans in formbeans, the BooleanConverter takes care of the type
conversion. This is in rc1.1

-----Original Message-----
From: Mark Galbreath [mailto:mark_galbreath@qat.com]
Sent: Thursday, May 08, 2003 10:29 AM
To: 'Struts Users Mailing List'
Subject: RE: Booleans in form beans


The fact is, the only thing that can be passed via HTTP is a String, no
matter what the underlying property type may be.

Mark

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Thursday, May 08, 2003 10:23 AM
To: Struts Users Mailing List
Subject: RE: Booleans in form beans


Well, "All" and "only" are a bit strong. Ignoring booleans, it's perfectly
fine for a form bean to have nested, indexed, and mapped properties. As for
checkboxes, boolean properties are actually the recommended way to go:

http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox

Quoting Mark Galbreath <ma...@qat.com>:

> All FormBean methods accept and return Strings only.  You can do type
> conversions, however, for use in a related Action.  Checkboxes return
> the value you specify on the form or "ON" by default.  The only way
> you can see if a checkbox has been checked is to initialize the
> FormBean property to "false" and be sure to reset it to "false" in
> reset();
>
> Mark
>
> -----Original Message-----
> From: Steven Sajous [mailto:steve@dotmarketing.com]
> Sent: Wednesday, May 07, 2003 5:33 PM
> To: Struts Users Mailing List
> Subject: Booleans in form beans
>
>
> I thought I read somewhere that I could use a boolean in my form bean
> for checkboxes, cannot remember where I saw that. Anyone has any idea?

--
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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



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



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



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


RE: Booleans in form beans

Posted by Mike Jasnowski <mj...@bea.com>.
we use booleans in formbeans, the BooleanConverter takes care of the type
conversion. This is in rc1.1

-----Original Message-----
From: Mark Galbreath [mailto:mark_galbreath@qat.com]
Sent: Thursday, May 08, 2003 10:29 AM
To: 'Struts Users Mailing List'
Subject: RE: Booleans in form beans


The fact is, the only thing that can be passed via HTTP is a String, no
matter what the underlying property type may be.

Mark

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Thursday, May 08, 2003 10:23 AM
To: Struts Users Mailing List
Subject: RE: Booleans in form beans


Well, "All" and "only" are a bit strong. Ignoring booleans, it's perfectly
fine for a form bean to have nested, indexed, and mapped properties. As for
checkboxes, boolean properties are actually the recommended way to go:

http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox

Quoting Mark Galbreath <ma...@qat.com>:

> All FormBean methods accept and return Strings only.  You can do type
> conversions, however, for use in a related Action.  Checkboxes return
> the value you specify on the form or "ON" by default.  The only way
> you can see if a checkbox has been checked is to initialize the
> FormBean property to "false" and be sure to reset it to "false" in
> reset();
>
> Mark
>
> -----Original Message-----
> From: Steven Sajous [mailto:steve@dotmarketing.com]
> Sent: Wednesday, May 07, 2003 5:33 PM
> To: Struts Users Mailing List
> Subject: Booleans in form beans
>
>
> I thought I read somewhere that I could use a boolean in my form bean
> for checkboxes, cannot remember where I saw that. Anyone has any idea?

--
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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



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



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


RE: Booleans in form beans

Posted by Mark Galbreath <ma...@qat.com>.
The fact is, the only thing that can be passed via HTTP is a String, no
matter what the underlying property type may be.

Mark

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Thursday, May 08, 2003 10:23 AM
To: Struts Users Mailing List
Subject: RE: Booleans in form beans


Well, "All" and "only" are a bit strong. Ignoring booleans, it's perfectly
fine for a form bean to have nested, indexed, and mapped properties. As for
checkboxes, boolean properties are actually the recommended way to go:

http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox

Quoting Mark Galbreath <ma...@qat.com>:

> All FormBean methods accept and return Strings only.  You can do type 
> conversions, however, for use in a related Action.  Checkboxes return 
> the value you specify on the form or "ON" by default.  The only way 
> you can see if a checkbox has been checked is to initialize the 
> FormBean property to "false" and be sure to reset it to "false" in 
> reset();
> 
> Mark
> 
> -----Original Message-----
> From: Steven Sajous [mailto:steve@dotmarketing.com]
> Sent: Wednesday, May 07, 2003 5:33 PM
> To: Struts Users Mailing List
> Subject: Booleans in form beans
> 
> 
> I thought I read somewhere that I could use a boolean in my form bean 
> for checkboxes, cannot remember where I saw that. Anyone has any idea?

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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



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


RE: Booleans in form beans

Posted by Kris Schneider <kr...@dotech.com>.
Well, "All" and "only" are a bit strong. Ignoring booleans, it's perfectly fine
for a form bean to have nested, indexed, and mapped properties. As for
checkboxes, boolean properties are actually the recommended way to go:

http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox

Quoting Mark Galbreath <ma...@qat.com>:

> All FormBean methods accept and return Strings only.  You can do type
> conversions, however, for use in a related Action.  Checkboxes return the
> value you specify on the form or "ON" by default.  The only way you can see
> if a checkbox has been checked is to initialize the FormBean property to
> "false" and be sure to reset it to "false" in reset();
> 
> Mark
> 
> -----Original Message-----
> From: Steven Sajous [mailto:steve@dotmarketing.com] 
> Sent: Wednesday, May 07, 2003 5:33 PM
> To: Struts Users Mailing List
> Subject: Booleans in form beans
> 
> 
> I thought I read somewhere that I could use a boolean in my form bean for
> checkboxes, cannot remember where I saw that. Anyone has any idea?

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


RE: Booleans in form beans

Posted by Mark Galbreath <ma...@qat.com>.
All FormBean methods accept and return Strings only.  You can do type
conversions, however, for use in a related Action.  Checkboxes return the
value you specify on the form or "ON" by default.  The only way you can see
if a checkbox has been checked is to initialize the FormBean property to
"false" and be sure to reset it to "false" in reset();

Mark

-----Original Message-----
From: Steven Sajous [mailto:steve@dotmarketing.com] 
Sent: Wednesday, May 07, 2003 5:33 PM
To: Struts Users Mailing List
Subject: Booleans in form beans


I thought I read somewhere that I could use a boolean in my form bean for
checkboxes, cannot remember where I saw that. Anyone has any idea?


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



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