上面的错误, 在struts.xml配置如下: <action name="addDept" class="deptWithUserAction" method="addDept"> <result name="success" type="dispatcher"> <param name="location">newDeptPop.jsp</param> </result> </action> 在action中代码如下: public String addDept() throws Exception { Department dept = new Department(); long compid = new Long(ActionContext.getContext().getSession().get("compid").toString()); long userid = new Long(ActionContext.getContext().getSession().get("userid").toString()); int cnt = 0;
<action name="addDept" class="deptWithUserAction" method="addDept">
<result name="success" type="dispatcher">
<param name="location">newDeptPop.jsp</param>
</result>
</action>
在action中代码如下:
public String addDept() throws Exception {
Department dept = new Department();
long compid = new Long(ActionContext.getContext().getSession().get("compid").toString());
long userid = new Long(ActionContext.getContext().getSession().get("userid").toString());
int cnt = 0;
dept.setCompany("");
dept.setCompID(compid);
dept.setDeptName(getpopdept());
dept.setMemo("");
dept.setStatus("A");
dept.setUpdDt(util.getCurrent());
dept.setUpdUsr(userid);
cnt = getAuthService().setDepartment(dept, "I");
if (cnt > 0) {
return "success";
}
else {
this.addFieldError("error", "新增部门时, 发生了错误!");
return "error";
}
}
我在FF中是没有一点问题的, 在IE中保存成功后, 刷新时会提示错误.