dao层public void updateStudent(StudentVO student) throws DAOException {
try {
if(null != student){
this.getSqlMapClient().update("updateStudent", student);
}
} catch (Exception e) {
throw new DAOException(e);
}
}biz层// 修改所有学员信息
public void updateStudent(StudentVO student) throws DAOException {
this.studentDao.updateStudent(student);
}
action层// 跳转到修改页面
public ActionForward toUpdateStudent(ActionMapping mapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws DAOException{
//StudentForm stuForm = (StudentForm)actionForm;
String stuId = request.getParameter("stuId");
StudentVO stuVO = new StudentVO();
stuVO = studentService.getStudentAllById(stuId);
request.setAttribute("stuVO", stuVO);
return mapping.findForward("updateStudent");
}
/**
* 修改学员信息
* @param mapping
* @param actionForm
* @param request
* @param response
* @return
* @throws DAOException
*/
public ActionForward doUpdateStudent(ActionMapping mapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws DAOException{
StudentForm stuForm = (StudentForm)actionForm;
StudentVO stuVO = new StudentVO();
stuVO.setStuId(stuForm.getStuId());
stuVO.setStuName(stuForm.getStuName());
stuVO.setStuAddress(stuForm.getStuAddress());
this.studentService.updateStudent(stuVO);
return this.doStudentList(mapping, actionForm, request, response);
}
然后就是保这样的错 javax.servlet.ServletException: java.lang.ClassCastException: java.lang.String
不知道怎么修改 用的是Struts+Spring+iBatis框架
try {
if(null != student){
this.getSqlMapClient().update("updateStudent", student);
}
} catch (Exception e) {
throw new DAOException(e);
}
}biz层// 修改所有学员信息
public void updateStudent(StudentVO student) throws DAOException {
this.studentDao.updateStudent(student);
}
action层// 跳转到修改页面
public ActionForward toUpdateStudent(ActionMapping mapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws DAOException{
//StudentForm stuForm = (StudentForm)actionForm;
String stuId = request.getParameter("stuId");
StudentVO stuVO = new StudentVO();
stuVO = studentService.getStudentAllById(stuId);
request.setAttribute("stuVO", stuVO);
return mapping.findForward("updateStudent");
}
/**
* 修改学员信息
* @param mapping
* @param actionForm
* @param request
* @param response
* @return
* @throws DAOException
*/
public ActionForward doUpdateStudent(ActionMapping mapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws DAOException{
StudentForm stuForm = (StudentForm)actionForm;
StudentVO stuVO = new StudentVO();
stuVO.setStuId(stuForm.getStuId());
stuVO.setStuName(stuForm.getStuName());
stuVO.setStuAddress(stuForm.getStuAddress());
this.studentService.updateStudent(stuVO);
return this.doStudentList(mapping, actionForm, request, response);
}
然后就是保这样的错 javax.servlet.ServletException: java.lang.ClassCastException: java.lang.String
不知道怎么修改 用的是Struts+Spring+iBatis框架
解决方案 »
- java新手上路,八方求援
- Jdbc中关于结果集(ResultSet)排序问题
- jsp连接数据库,上传头像如何实现?
- 如何将jsp页面静态化,管理起来.像CSDN一样把贴子静态化.在用户信息更新后,如何更新已生成的html页面
- Quartz 线城池的运行时
- 高分!!!我想要做一个查询日期段,如2008-01-10至2008-02-10记录
- jdk+tomcat+sqlserver2000配置
- 请大家给推荐一些学习mvc,hibernate,struts,spring的好书,谢谢!!
- 一个JSF的问题....
- 打算学J2EE,请问各位J2EE前辈我最好应该怎样做!
- hibernate 中oracle自增序列插入问题
- 请教Spring的问题
自己去配置文件里面去找,是不是string类型不配对数据库类型的。。
哪行出现的...
public ActionForward toUpdateStudent(ActionMapping mapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws DAOException{
//StudentForm stuForm = (StudentForm)actionForm;
String stuId = request.getParameter("stuId"); StudentVO stuVO = new StudentVO();
stuVO = studentService.getStudentAllById(stuId);
request.setAttribute("stuVO", stuVO);
return mapping.findForward("updateStudent");
}
是不是标红的这段错了,你强制转换一下吧