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框架

解决方案 »

  1.   

    java.lang.String
    自己去配置文件里面去找,是不是string类型不配对数据库类型的。。
      

  2.   

    首先需要单步debug调试一下,定位到java.lang.ClassCastException异常信息是在
    哪行出现的...
      

  3.   

    // 跳转到修改页面
        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");
        }
    是不是标红的这段错了,你强制转换一下吧
      

  4.   

    如果struts的form里面配置的就是string是不需要强转的。。他都说了全部string