• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make a checkbox checked using struts tag  RSS feed

 
mash john
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Jo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!