html:multibox的问题
JSP页面代码如下:
<logic:iterate id= "element " name= "admins ">
<tr>
<td align= "center "> <html:multibox property= "selectedActions "> <bean:write name= "element " property= "id "/> </html:multibox> </td>
<td align= "center "> <bean:write name= "element " property= "id "/> </td>
<td align= "center "> <bean:write name= "element " property= "pwd "/> </td>
</tr>
</logic:iterate>
我想在Action类里把selectedActions的第一个值取出来,应该怎么做?
我是这样写的:
String boxList[] = AdminForm.getSelectedActions();
String user_id = boxList[0];
但是不行,在String user_id = boxList[0];这一行报错:
java.lang.ArrayIndexOutOfBoundsException 似乎是
数组越界的问题?请教各位高手应该怎么做,在线等
------解决方案--------------------public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
List list=coursedao.findAllCourses();
request.getSession().setAttribute( "courses ",list);
return mapping.findForward( "showall ");
}
<body>
<html:form action= "/mySelect " method= "post ">
<center> <bean:message key= "message.system.ui.showCoursesForm.allCourses "/> </center> <br>
<logic:iterate id= "course " name= "courses " scope= "session ">
<html:multibox property= "courses ">
<bean:write property= "couId " name= "course "/>
</html:multibox>
<bean:write property= "couName " name= "course "/>
</logic:iterate>
<html:submit> </html:submit>
<html:reset> </html:reset>
</html:form>
</body>
===================
类似上面
具体参考我的博客
http://blog.csdn.net/kipen/archive/2007/04/10/1559676.aspx