jsp中由Action传来的list再传给Action
hdl17 2011-08-02 05:10:30 jsp:
<c:forEach var="list" items="${list}">
<tr><td><input type="checkbox" name="publish" id="publish" value="${list.anc_who }"/></td>
<td>${list.anc_title}</td>
<td id="anc_content">${list.anc_content }
<input type="hidden" name="anc_id" value="${list.anc_id }"/></td>
</tr>
</c:forEach>
<tr><td><input type="submit" value="确定" /><input type="hidden" name="count" id="count" value="" /></td>
<td id="AncTitleError" style="display:none;"><s:property value="errors.anc_title[0]"/></td>
<td><input type="reset" value="取消" /></td>
</tr>
count是js计算用户所选择的checkbox的个数
Action:
Integer anc_id[];
Integer anc_who;
int count=0;
public Integer getAnc_who() {
return anc_who;
}
public void setAnc_who(Integer anc_who) {
this.anc_who = anc_who;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Integer[] getAnc_id() {
return anc_id;
}
public void setAnc_id(Integer[] anc_id) {
this.anc_id = anc_id;
}
public String Publish() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException{
list=ad.Query();
if(count!=0){
anc_id=new Integer[count];
for(int i=0;i<count;i++){
ad.Publis(anc_id[i], anc_who);
}
}
return SUCCESS;
}
问题:anc_id在Action中的值为null.请高手指点!多谢!