提交完之后多选框选中的值还保存在页面上2011-10-28 javaeye heisetoufa首先在jsp页面上checkbox的property值不能相同,如下Html代码
<html:checkbox property="testBox1" value="chargeStat01">处罚开始</html:checkbox><html:checkbox property="testBox2" value="chargeStat01">处罚开始</html:checkbox>
form:Java代码
public class ChargeStatForm extends ActionForm { private String testBox; public String getTestBox() { return testBox; } public void setTestBox(String testBox) { this.chargeStatChargeItemInput=""; this.testBox = testBox; } }这样就可以让提交之后出现错误信息之后多选框不被置空,而是原先选中什么现在还选中什么的状态