org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [springmvc] in context with path [/springmvcmybatis] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'priceLow' not found. Available parameters are [1, 0, param1, param2]] with root cause
严重: Servlet.service() for servlet [springmvc] in context with path [/springmvcmybatis] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'priceLow' not found. Available parameters are [1, 0, param1, param2]] with root cause
org.apache.ibatis.binding.BindingException: Parameter 'priceLow' not found. Available parameters are [1, 0, param1, param2]
这段异常是出现在ssm框架中
这个异常很多人会认为是数据库的语句接收参数异常,就会一直看xml文件的数据库语句,其实不然。
解决办法,将持久层(dao)中的接口public List<ItemsCustom> findItemsByPrice(Integer priceLow, Integer priceHigh) throws Exception;
改为下面的
public List<ItemsCustom> findItemsByPrice(@Param("priceLow") Integer priceLow,@Param("priceHigh") Integer priceHigh) throws Exception;
第一次写博客,感觉自己萌萌哒