详情 修改 删除 分配角色 登录上来之后 点击修改,操作无异常,也可以修改,跳转页面都很正常,但是修完完之后,又点击详情,查看用户详情的操作,就不能修改了。还报这个异常:
2011-03-22 11:21:26,984 WARN [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'emp.id' with value '[Ljava.lang.String;@264dd8'
ognl.OgnlException: target is null for setProperty(null, "id", [Ljava.lang.String;@264dd8) /**
* 跳到要修改详情的页面
* @return
* @throws Exception
*/
public String toUpdate()throws Exception{
this.emp = this.employeeService.getEmployee(emp.getId());
List<Department> depts = this.departmentService.getDepts();
List<Position> posts = this.positionService.getPosts();
put2ActionContext("depts", depts);
put2ActionContext("posts", posts);
return TO_UPDATE;
}
/**
* 修改详情
* @return
* @throws Exception
*/
public String update() throws Exception{
Employee real = this.employeeService.getEmployee(this.emp.getId());
real.setName(emp.getName());
real.setEmail(emp.getEmail());
real.setAddress(emp.getAddress());
real.setBirthday(emp.getBirthday());
real.setDepartment(emp.getDepartment());
real.setPositions(emp.getPositions());
real.setFphone(emp.getFphone());
real.setMobile(emp.getMobile());
real.setQQ(emp.getQQ());
real.setMSN(emp.getMSN());
real.setRe(emp.getRe());
real.setRole(emp.getRole());
real.setGender(emp.getGender());
real.setJobnumber(emp.getJobnumber());
real.setEntry(emp.getEntry());
real.setDeparture(emp.getDeparture());
real.setOrigin(emp.getOrigin());
real.setTelephone(emp.getTelephone());
this.employeeService.updateEmployee(real);
this.result = "success";
return SUCCESS;
}struts2.xml 这样的配置
<package name="empMng" namespace="/emp" extends="my-default">
<action name="*" class="com.make.web.controller.EmployeeAction" method="{1}">
<result name="toupdate">/emp/empUpdate.jsp</result>
<result name="success" type="json">
<param name="root">result</param>
</result>
</action>
</package>
2011-03-22 11:21:26,984 WARN [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'emp.id' with value '[Ljava.lang.String;@264dd8'
ognl.OgnlException: target is null for setProperty(null, "id", [Ljava.lang.String;@264dd8) /**
* 跳到要修改详情的页面
* @return
* @throws Exception
*/
public String toUpdate()throws Exception{
this.emp = this.employeeService.getEmployee(emp.getId());
List<Department> depts = this.departmentService.getDepts();
List<Position> posts = this.positionService.getPosts();
put2ActionContext("depts", depts);
put2ActionContext("posts", posts);
return TO_UPDATE;
}
/**
* 修改详情
* @return
* @throws Exception
*/
public String update() throws Exception{
Employee real = this.employeeService.getEmployee(this.emp.getId());
real.setName(emp.getName());
real.setEmail(emp.getEmail());
real.setAddress(emp.getAddress());
real.setBirthday(emp.getBirthday());
real.setDepartment(emp.getDepartment());
real.setPositions(emp.getPositions());
real.setFphone(emp.getFphone());
real.setMobile(emp.getMobile());
real.setQQ(emp.getQQ());
real.setMSN(emp.getMSN());
real.setRe(emp.getRe());
real.setRole(emp.getRole());
real.setGender(emp.getGender());
real.setJobnumber(emp.getJobnumber());
real.setEntry(emp.getEntry());
real.setDeparture(emp.getDeparture());
real.setOrigin(emp.getOrigin());
real.setTelephone(emp.getTelephone());
this.employeeService.updateEmployee(real);
this.result = "success";
return SUCCESS;
}struts2.xml 这样的配置
<package name="empMng" namespace="/emp" extends="my-default">
<action name="*" class="com.make.web.controller.EmployeeAction" method="{1}">
<result name="toupdate">/emp/empUpdate.jsp</result>
<result name="success" type="json">
<param name="root">result</param>
</result>
</action>
</package>
解决方案 »
- Extjs 根据树节点动态生成FormPanel里面的组件
- java 实现在线图片编辑
- tomcat运行数据库操作的servlet文件时出现 HTTP Status 500 错误怎么解决???(急急急急
- 迷茫中,请在IT行业里有经验的前辈们多多发言...
- itext的使用资料,求助中。。。
- 在JSP中怎么样定时关闭窗口
- 请问如何把“\”替换成“\\”,用了replace(),replaceAll()都不行
- 早问...................
- 关于showModelessDialog的请教
- 求大神
- 新手初学tomcat问题《HTTP Status 404 - /host-manager/html》
- JS得到按钮传来参数得值的问题 会的都来看下 急求!!!!
com.opensymphony.xwork2.ognl.OgnlValueStack 你的xwork2报错了不是!
target is null for setProperty(null, "id", [Ljava.lang.String;@264dd8)
目标是空的~~~说明你的“Id”字段取不到值。
在你的详情页面中加入一个name为Id的元素(就是与你Action对应的那个)、在看看!当然记得把value给设置上去!
你的emp.id能跟你的Action中的属性对应不?
你修改完之后,此时你的emp.id为空了,你检查下你的emp.id是否为空??哪里没有设置值
ognl.OgnlException: target is null for setProperty(null, "id", [Ljava.lang.String;@98d70d)
于是就修改了那个对象的set函数名,然后就OK了~