• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make a checkbox checked using struts tag

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic