Cause: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "goods_nam...

  記錄一下這個錯誤。前端

報錯緣由:spring

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'pd.goods_name!= null and pd.goods_name!= '''. Cause: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "goods_name")express

分析:apache

因爲項目框架裏有個將map封裝成PageData,我經過new PageData ,將前端jsp傳到controller的參數進行保存。不過沒有再作pd.put("goods_name",pd.getString("goods_name"));處理,而此時maping.xml裏就不能在用pd獲取了。(它會直接用它封裝的方法,return 一個map)api

 

錯誤寫法:mybatis

<if test="pd.goods_name!= null and pd.goods_name!= ''"> and goods_name like concat('%', #{pd.goods_name},'%') </if>

 

把pd.去掉便可。框架

<if test="goods_name!= null and goods_name!= ''"> and goods_name like concat('%', #{goods_name},'%') </if>
相關文章
相關標籤/搜索