Mapper method 'com.zwt.springmvc.crud.Dao.EmployeeDao.DeleteId' has an unsupported return type: class com.zwt.springmvc.crud.entities.Employee
解決:html
delete, update, insert等操做單時候,dao層返回爲int類型java
Employee DeleteId(Integer id); 應改成 int DeleteId(Integer id);
delete操做返回intmysql
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).
解決:spring
頁面輸入數據的時候格式不正確sql
salary :1.222.333.1 改成#,###,###.#
問題mvc
刪除完成返回時出現:app
頁面顯示redirect:/epms,卻並不跳轉jsp
解決:ide
去掉@ResponseBody註解spa
問題:
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驅動程序已被強制取消註冊。
解決: