| Author |
html:checkbox or html:multibox
|
Aparna Sharma
Ranch Hand
Joined: Mar 12, 2003
Posts: 30
|
|
Hi, I have a jsp which shows a drop down combobox, a text box and submit cancel buttons. the drop down combo box is a collection of objects. to be exact an arraylist which is placed in session in the action class. The object is a technique object which has the following attributes: techCd : type String : primary key techDscr : type String : a description of the technique actCd : type String : can be A indicating Active and D indicating Deleted ----------------------Earlier only these where present-------------------- ----------------------------------------------------------------------- Earlier the value can be selected and updated. select an old technique and enter the new description in the textbox. But now I need to place a checkbox alongside the drop down combo box , so that the checkbox gets checked when the selection in the combobox changes. I read everything I could on how to implement this, and I think I need to do this via html:multibox ----------------------Now trying to implement checkboxes------------- ------------------------------------ the above code gives me a [ServletException in:/tiles/modifytile.jsp] Cannot create iterator for this collection' I have the following code in my ModifyForm Could anyone give any suggestions/help on what am I doing wrong, please? Is it possible to check/uncheck a checkbox/multibox based on the selected value in the dropdown combo box? I think it will be simpler to write them as a list using <bean;write> and place checkboxes along side for each as indicated in this article http://www.onjava.com/pub/a/onjava/2003/07/30/jakartastruts.html?page=last But when there are too many values , the page can be too long. If I use a single select list , the display will be better and users can easily navigate to a value , but we should only have a single checkbox and the problem becomes similar to that I am facing now. single select list code sample http://javaboutique.internet.com/tutorials/strutsform/index-4.html Please help out. my only other option is scriplets. Thanks, Aparna
|
Aparna Sharma<br />SCJP 1.4 (yippeeee!)
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
So when the user selects a different option in the list the checkbox check needs to toggle? If so, that's a javascript thing.
|
A good workman is known by his tools.
|
 |
Aparna Sharma
Ranch Hand
Joined: Mar 12, 2003
Posts: 30
|
|
|
But arent they in the same collection as attributes of a bean/object?
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
|
It doesn't matter because the user is interacting with html by that point. The Java code, scriptlets, and Struts tags don't exist anymore because it's already done its job and sent the html to the user's browser.
|
 |
Aparna Sharma
Ranch Hand
Joined: Mar 12, 2003
Posts: 30
|
|
ok..some light shines through! I assume I would be doing a javascript like onchange="getStatus(techCd)" where techCd is the primary key attribute , which goes to the server and brings back the checked/unchecked status. Then how can you think I can make this work?
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
With what you just described, you'd have to submit the entire form. A better solution might be to use the Strutstags/scriptlets/whatever to create a collection in javascript to hold all the possible checkbox mates for the list values. That way, an onchange event on the client (the user's browser) can handle the change internally without needing to submit the entire form to the server.
|
 |
 |
|
|
subject: html:checkbox or html:multibox
|
|
|