Mapper method ‘com.zwt.springmvc.crud.Dao.EmployeeDao.DeleteId‘ has an unsupported return type: class com.zwt.springmvc.crud.entities.Employee
解决:
delete, update, insert等操作单时候,dao层返回为int类型
Employee DeleteId(Integer id); 应改为 int DeleteId(Integer id);
delete操作返回int
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
解决:
页面输入数据的时候格式不正确
salary :1.222.333.1 改为#,###,###.#
问题
删除完成返回时出现:
页面显示redirect:/epms,却并不跳转
解决:
去掉@ResponseBody注解
问题:
Request method ‘PUT‘ not supported
解决:
@RequestMapping(value="/emp/{id}", method=RequestMethod.POST) public String update(Employee employee,Map<String, Object> map){ map.put("employee", employee); employeeDao.update(employee); System.out.println("update success"); return "redirect:/epms"; }
将上方代码改为如下:
@RequestMapping(value = "/emp", method = RequestMethod.PUT) public String update(Employee employee){ employeeDao.update(employee); System.out.println("Success" +employee); return "redirect:/epms"; }
问题
check the manual that corresponds to your MySQL server version for the right syntax to use near ‘= ‘111@qq.com‘, gender = null, department = ‘镨镨2‘,salary = nullwhere i‘ at line 1
似乎sql写错了
UPDATE employee SETemail = #{email}, gender = #{gender}, department = #{department},salary = #{salary}where id = #{id}
解决:
在SET后添加空格
问题:
前段页面显示中文乱码
解决:
jsp页面中加入
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
错误:
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
解决:
原因是导入的依赖于Mybatis冲突
删除下方依赖即可
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator --><dependency> <groupId>org.hibernate.validator</groupId> <artifactId>hibernate-validator</artifactId> <version>6.0.16.Final</version> </dependency>
问题:
Tomcat关闭时报错
Web应用程序 [ROOT] 注册了JDBC驱动程序 [com.mysql.jdbc.Driver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。
解决:
原文:https://www.cnblogs.com/SuperT/p/11337853.html