mvc传值:
乱码问题:数据库,过滤器,ide环境都是utf-8还出现乱码;<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这里的url-pattern里面少写了*号导致的
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:
Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (oa
.employee
, CONSTRAINT FK_Reference_1
FOREIGN KEY (department_sn
) REFERENCES department
(sn
))
The error may involve com.imooc.oa.dao.DepartmentDao.delete-Inline
The error occurred while setting parameters
SQL: delete from department where sn=?
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (oa
.employee
, CONSTRAINT FK_Reference_1
FOREIGN KEY (department_sn
) REFERENCES department
(sn
))
; SQL []; Cannot delete or update a parent row: a foreign key constraint fails (oa
.employee
, CONSTRAINT FK_Reference_1
FOREIGN KEY (department_sn
) REFERENCES department
(sn
)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (oa
.employee
, CONSTRAINT FK_Reference_1
FOREIGN KEY (department_sn
) REFERENCES department
(sn
))
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.imooc.oa.global.EncodingFilter.doFilter(EncodingFilter.java:28)
MySQL外键相关知识: