1.后台数据在网页页面不显示
原因忘了写下面用来显示的语句
2.id=null(获取不到id)
原因: 对应的函数没有写与之对应的id,导致无法接收到id
sql语句写错了或者resultMap中id写错也会出现id=null的情况
3.写完add方法后,可以添加,但是值为null
原因:没有赋值name属性,导致xml映射后在html中找不到对应的属性名
4.id可以获取到,但是点击修改后仍然报错
ERROR (DirectJDKLog.java:175)- Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: com.yuan.manage.entity.GoodsSafeguardType cannot be cast to java.lang.Integer] with root cause
错误及修改位置
最终改后的正确显示
5.修改保存后页面报错
nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘safeguard_type_info’ in ‘class com.yuan.manage.entity.GoodsSafeguardType’
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘safeguard_type_info’ in ‘class com.yuan.manage.entity.GoodsSafeguardType’
错误及修改位置 改为safeguardTypeInfo
6.未能转换类型‘java.lang’的值
2021-09-04 20:31:17,854 WARN (AbstractHandlerExceptionResolver.java:199)- Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Integer[]’; nested exception is java.lang.NumberFormatException: For input string: “row.safeguardTypeId”]
更改位置
7.时间格式无法转换错误
There was an unexpected error (type=Bad Request, status=400).
Validation failed for object=‘brandInfo’. Error count: 1
org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object ‘brandInfo’ on field ‘brandFoundedDate’: rejected value [2021-09-05]; codes [typeMismatch.brandInfo.brandFoundedDate,typeMismatch.brandFoundedDate,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [brandInfo.brandFoundedDate,brandFoundedDate]; arguments []; default message [brandFoundedDate]]; default message [Failed to convert property value of type ‘java.lang.String’ to required type ‘java.util.Date’ for property ‘brandFoundedDate’; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat java.util.Date] for value ‘2021-09-05’; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2021-09-05]]
原因是忘记写转换的格式,导致无法识别解决
8.类路径问题
错误及修改位置 首字母大小写错误
9. 路径错误
原因是路径错误,修改处如下
10. 47行报错
controller控制器中名字与edit中不一致
昨晚47行报错位置及更改
11.空指针异常
没有写autowired
12.外键约束导致删除失败,并不是代码问题
Cannot delete or update a parent row: a foreign key constraint fails
13.文件创建位置错误
mapper位置创建错误