1.
rear end:
Resolved exception caused by Handler execution: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
front end:
Report 415 error
The reason is that contentType in ajax is mistakenly written as contextType
2.
rear end:
2018-02-09 14:04:01.665 WARN 6628 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public org.springframework.http.ResponseEntity<java.lang.Void> com.zyc.controller.AccountController.login(com.zyc.model.Account) 2018-02-09 14:04:01.665 WARN 6628 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public org.springframework.http.ResponseEntity<java.lang.Void> com.zyc.controller.AccountController.login(com.zyc.model.Account)
front end:
Report 400 error
Check and find that after the data in the form is converted into json, the json value is undefined
reason,
var json=JSON.stringify($("#form1").serializeObject);change to
var json=JSON.stringify($("#form1").serializeObject());///?()
Add () after serializeObject. Older versions of the ij compiler did not automatically add parentheses when selecting serializeObject directly.
3.
rear end:
2018-02-09 14:18:53.569 ERROR 7460 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [arg1, arg0, param1, param2]] with root cause org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [arg1, arg0, param1, param2]
front end:
Report 500 error
reason,
The dao layer, which is the mapper layer
Account login(String username,String password);change to
Account login(@Param("username") String username,@Param("password")String password);
4.
rear end:
Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where password = '41234321'' at line 1
front end:
Report 500 error
reason,
The @Select in the dao layer should be
"where username = #{username,jdbcType=VARCHAR} and"+ " password = #{password,jdbcType=VARCHAR}"
or
"where username = #{username,jdbcType=VARCHAR} and", "password = #{password,jdbcType=VARCHAR}"
cannot be
"where username = #{username,jdbcType=VARCHAR} and"+ " where password = #{password,jdbcType=VARCHAR}"
nor can it be
"where username = #{username,jdbcType=VARCHAR} and"+ "password = #{password,jdbcType=VARCHAR}"
5
The data of the pet type drop-down menu cannot be displayed during registration
Backend does not report errors
front end 409 error
It is found that the service layer will
example.createCriteria().andCatidIsNotNull();
misspelled
example.createCriteria().andCatidIsNull();
6
rear end
WARN 7528 --- [io-8080-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize value of type java.lang.Integer from String "data[index].catid": not a valid Integer value; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type java.lang.Integer from String "data[index].catid": not a valid Integer value at [Source: java.io.PushbackInputStream@2e22a57c; line: 1, column: 153] (through reference chain: com.zyc.model.Account["profile"]->com.zyc.model.Profile["catid"])
前端报400错误
原因是reg.js中应该是
$("#category").append("<option value='"+data[index].catid+"'>"+data[index].name+"</option>")
而不是
$("#category").append("<option value='data[index].catid'>"+data[index].name+"</option>")
注意上述代码option标签中value中的值。下图中lang和catid断点值会让错误更清晰