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--------------------
<TR><TD>
<html:select name="<%=Constants.MODIFY_FORM%>" property="techUsed"
tabindex="1">
<html options collection="techAL" property="techCd"
labelProperty="techDscr" /> </html:select>
</TD></TR>
<TR><TD>
<html:text name='modifyForm' property='techUsedNew'/>
</TD></TR>
--------------------------------------------------------------------------------
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-------------
<!-- definitions in the jsp-->
<bean define id="modifyForm" name="<%=Constants.MODIFY_FORM%>"
scope="session"type="com.web.forms.ModifyForm"/> <bean
efine
id="techAL" name="<%=Constants.TECH_LIST%>" scope="request"/>
<!-- code giving error-->
<logic:iterate id="obj" collection="<%=Constants.TECH_LIST%>">
<html:select name="<%=MODIFY_FORM%>" property="techUsed" tabindex="1">
<html options collection="techAL" property="techCd" labelProperty="techDscr" />
<html:multibox name="<%=MODIFY_FORM%>" property="selected">
<bean:write name="obj" property="techCd"/>
</html:multibox>
</html:select>
</logic:iterate>
--------------------------------------------------------------------------------
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
code:
--------------------------------------------------------------------------------
private String techUsed;
private String[] selected;
public String[] getSelected()
{
return selected;
}
public void setSelected(String[] newSelected)
{
selected = newSelected;
}
public String getTechUsed()
{
return techUsed;
}
public void setTechUsed(String str)
{
this.techUsed = str;
}
--------------------------------------------------------------------------------
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,
Rosemary
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]