Ivorybeach
王逍遥这是我们的狗
2017-12-02 03:31

column "" can not be null springmvc+mybatis

  • spring
  • mybatis

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'userName' cannot be null

The error may exist in com/demo/dao/UserMapper.xml

The error may involve com.demo.dao.UserMapper.insertUser-Inline

The error occurred while setting parameters

SQL: insert into user (userName,password,id) values (?,?,?)

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'userName' cannot be null

; SQL []; Column 'userName' cannot be null; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'userName' cannot be null
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:927)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107

一直提示字段不能为空,这是因为没有接收到页面的请求参数吗?所以#{}接收不到值?怎样解决,求好心人搭救,感谢!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐