Subject: checkbox checked by default by html:checkbox
Posted By: sachin.tathod Post Date: 8/12/2006 1:31:15 AM
Hi

can any one tell me how to make checkbox checked by default by <html:checkbox> </html:checkbox>  ??

Plz note :- I can make it by using following .

 <input type="checkbox" name="showRewardProgram" class="checkbox" checked/>

But i want to use struts tag <html:checkbox> explicitly .

Thanx

Sachin




Thanks and Regards,
SACHIN S.TATHOD
Patni Computer System Ltd.
Magarpatta City, Cyber City,
Tower 3,Level I & II,
Hadapsar,Pune - 411028
Mobile No:- +91-9881239401
Email ID:- sachin.tathod@patni.com
Reply By: panacea Reply Date: 8/16/2006 3:37:30 AM
Hi Sachin,

You just have to set the property that the checkbox is linked to to true before you forward to the JSP.  For example, if you have <html:checkbox property="foo">, inside a form named myForm, do myForm.setFoo(true) inside your Action.

Jon Emerson
http://blogs.adobe.com/jon.emerson/
Reply By: balakrishna Reply Date: 11/14/2006 5:38:54 PM
How can i enable check box by default in struts. Pls give the sol ASAP

Reply By: jenny_uy81 Reply Date: 12/4/2006 2:41:59 PM
thanks panacea!

Your suggestion worked for me.

I just did the following steps:
1. property "foo" should be boolean type in the ActionForm class
2. set foo to true before the jsp is generated, I placed setFoo(true)on my init() method.

thanks



Go to topic 53173

Return to index page 103
Return to index page 102
Return to index page 101
Return to index page 100
Return to index page 99
Return to index page 98
Return to index page 97
Return to index page 96
Return to index page 95
Return to index page 94