| Author |
How to make a checkbox checked using struts tag
|
mash john
Greenhorn
Joined: Sep 04, 2005
Posts: 15
|
|
I want to check a checkbox using a struts tag. I am using html:checkbox,but not finding any atttribute to check or uncheck it.In html tags we have a attribute called checked,if we say checked="true", it will be checked.But how we do that in struts? Regards Mash John
|
 |
Nathaniel Stoddard
Ranch Hand
Joined: May 29, 2003
Posts: 1258
|
|
|
You should set the value in your ActionForm. The tag will make sure the checkbox is checked for you, based on the value is gets for that property from your ActionForm.
|
Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
|
 |
Eric Jo
Greenhorn
Joined: Apr 09, 2005
Posts: 4
|
|
Nathan, That's good advice. I have (I think) a harder problem. Maybe you can help. I am using a DynaValidatorForm. The pertinent sections of my struts-config.xml: ------ My problem is I need to pre-populate fields the first time my form is called. I thought I might be able to access a form bean object named "contactUsForm" so I stuck some scriptlet at the top of my JSP: Well, no luck. Here's the complaint I get from Tomcat: My question is, how do I get a handle to my form? The page that is calling me is using a pass thru so it would be nice not to clutter it with my needs. I'd really like to get a handle to my form at the top of my JSP. Assuming that can't be done, any other suggestions are welcome. Thanks in advance, Eric
|
 |
 |
|
|
subject: How to make a checkbox checked using struts tag
|
|
|