Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes display check box based on the value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display check box based on the value" Watch "display check box based on the value" New topic
Author

display check box based on the value

johny sil
Greenhorn

Joined: Jul 11, 2006
Posts: 13
Hi,

I want to display checkboxes based on the value come from the database,

If the value is "true" checkbox is displayed as checked.

Plaese send sample code,

Thanks in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you use the <html:checkbox> tag, Struts automatically checks or unchecks the box based on the value of the property you specify.

So, if you write:

<html:checkbox property="insured" value="true" />

Struts will assume you have a boolean property "insured" in your ActionForm bean, and if it's true will show the box as checked, and if it's false, will show the box as unchecked.
[ July 21, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display check box based on the value
 
Similar Threads
Best way to display/not display a div based on a value in my JavaBean
How to display value based on jstl locale
showing database value in tree view format
Struts 1.1: html:radio issues
Bean value to JSP var