一、问题描述
在编写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

二、问题解决
首先,想到的是sql语句报错,但是反复检查sql语句发现并没有问题,
又先后检查dao层、service层和controller层发现语法并没有问题。
直到查至applicationContext.xml文件中:

由于setter方法要将方法的首字母小写!!!
到service中的Impl中发现果然setter方法没有被使用,导致整体报错,访问数据库回传数据失败!

所以,细节问题一定要注意!!!
欢迎关注博主,欢迎互粉,一起学习!
感谢您的阅读,不足之处欢迎指正!
本文描述了在使用Spring和Spring-MVC框架时遇到的HTTPStatus500错误,详细分析了问题原因在于setter方法未正确调用,导致数据库访问失败。通过检查applicationContext.xml配置文件,定位并修复了问题。
2595

被折叠的 条评论
为什么被折叠?



