Re: Struts, checkbox and optionally displaytag
thanks ! --- Koon Yue Lam <[EMAIL PROTECTED]> wrote: > Hi ! > > From your question, I guess that you need a multiple > of checkboxes, so > you need instead of > > for your reference: > http://struts.apache.org/userGuide/struts-html.html#multibox > > and a wonderful example: > http://j2ee.lagnada.com/struts/multibox-example1.htm > > you would need an action form, which contains 2 > arrays (normally they > would be String array) > eg. an Action form called FrmMultiBox with > properties : > String [] options; String[] selected; > > options[] is holding the "options" of the checkboxes > that user going to select > selected[] would be populated by Struts after form > submission, value > of selected[] is the value of "checked" checkboxes. > > so if options = new String {"1", "2", "3"} (you can > made them final or > load the values from another Action dynamically from > somewhere else) > > in your JSP: > > property="options"> > property="selected"> > name="_bean"/> > > > > > if user check "1" and "3" then selected[] would > contains "1" and "3" > (Thanks Struts !) > > and don't forget the formal getter and setter method > of your Action form > > Hope this help > > Regards > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts, checkbox and optionally displaytag
Hi ! >From your question, I guess that you need a multiple of checkboxes, so you need instead of for your reference: http://struts.apache.org/userGuide/struts-html.html#multibox and a wonderful example: http://j2ee.lagnada.com/struts/multibox-example1.htm you would need an action form, which contains 2 arrays (normally they would be String array) eg. an Action form called FrmMultiBox with properties : String [] options; String[] selected; options[] is holding the "options" of the checkboxes that user going to select selected[] would be populated by Struts after form submission, value of selected[] is the value of "checked" checkboxes. so if options = new String {"1", "2", "3"} (you can made them final or load the values from another Action dynamically from somewhere else) in your JSP: if user check "1" and "3" then selected[] would contains "1" and "3" (Thanks Struts !) and don't forget the formal getter and setter method of your Action form Hope this help Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts, checkbox and optionally displaytag
hi, guess many questions were raised on this but could not find detail enough sample code. i am looking for sample code demostrating the support of checkbox in Struts ActionForm, Action and JSP files. I am using displaytag (really good!) to generate the table with a column of checkboxes. how do i know which boxes are selected in MyAction ? many thanks lixin __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]