You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rahul Chaudhary <ra...@hotmail.com> on 2002/02/11 01:17:19 UTC

String[] for html:select---Urgent

The following error is being generated while using a String[] for 
<html:select>.Looking forward to your help.

javax.servlet.ServletException: BeanUtils.populate
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
	at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)


There is this code in the jsp:

<% int i = 0;%>
<logic:iterate id="description" name="FormBeanName" property="description" 
type="java.lang.String">
<% String userSelect = "userSelect["+i+"]";%>
<tr>
<td >&nbsp;</td>
<td >&nbsp;<bean:write name="description"/></td>
<td >&nbsp;<html:select property="<%=userSelect%>">
<html:option value="0">--Select Field --</html:option>
<html:options property="Options"/>
</html:select></td>
<td >&nbsp;</td>
</tr>
<% i =i+1;%>
</logic:iterate>

In the formBean the mutators are as follows:
String[] userSelect;

public String[] getUserSelect() {
    return userSelect;
}
public void setUserSelect(String[] _userSelect) {
    userSelect= _mapFieldSelect;
}
public void setUserSelect(int index,String _userSelect) {
    userSelect[index] = _userSelect;
}
public String getUserSelect(int index) {
    return userSelect[index];
}

In the reset() of the form bean there is this code:

      int userSelectLength = userSelect.length;
      for (int i=0;i<userSelectLength ;i++) {
        setUserSelect(i,null);
      }


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>