struts的复选框html:multibox的问题
为什么在页面上html:multibox的取值数组的长度为0;
JSP页面:
Vector vecPart=(Vector)session.getAttribute("partList");
TopicDisp partList=null;
if(vecPart!=null)
{
for(int i=0;i<vecPart.size();i++)
{
partList=(TopicDisp)vecPart.get(i);
%>
<tr bgcolor="#CCFFFF">
<td>
<html:multibox property="selectBox"><%=partList.getId()%></html:multibox><%=partList.getId()%>
</td>
<td><%=partList.getId()%></td>
<td><%=partList.getTitle()%></td>
<td><%=partList.getContent()%></td>
</tr>
<%
}
}
FORM页面:
private String[] selectBox=new String[0];
public String[] getSelectBox()
{
return selectBox;
}
public void setSelectBox(String[] selectBox)
{
this.selectBox = selectBox;
}
public void reset(ActionMapping mapping,HttpServletRequest request)
{
this.selectBox=new String[0];
}
ACTION部分为:
SaveRecrodForm sForm=new SaveRecrodForm();
String[] sId=sForm.getSelectBox();
System.out.println("sId.length="+sId.length);
for(int i=0;i<sId.length;i++)
System.out.println(sId[i]);