This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to make a checkbox checked using struts tag Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "How to make a checkbox checked using struts tag" Watch "How to make a checkbox checked using struts tag" New topic
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to make a checkbox checked using struts tag
 
Similar Threads
checkbox value to servlet
No "CHECKED" feature for html:radio ?
PreCheck the Checkbox of struts
In struts el how to get checkbox status
how to retain checkbox status during pagination in struts