一、问题描述

在编写spring和spring-MVC框架的时候,出现问题:

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
type Exception report
message Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
description The server encountered an internal error that prevented it from fulfilling this request.
exception

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram


二、问题解决

首先,想到的是sql语句报错,但是反复检查sql语句发现并没有问题,

又先后检查dao层、service层和controller层发现语法并没有问题。

直到查至applicationContext.xml文件中:

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram

由于setter方法要将方法的首字母小写!!!

到service中的Impl中发现果然setter方法没有被使用,导致整体报错,访问数据库回传数据失败!

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram

所以,细节问题一定要注意!!!


 

       欢迎关注博主,欢迎互粉,一起学习!

       感谢您的阅读,不足之处欢迎指正!

 

相关文章: