出現這個錯誤是由於在執行sql的時候無法匹配sql語句的通配符造成的,有兩個解決方法
具體步驟
org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [0, 1, param1, param2]1
出現這個錯誤是由於在執行sql的時候無法匹配sql語句的通配符造成的,有兩個解決方法。
1.在對應dao的xml文件的sql語句要這樣寫
<select id="findByUsernameAndPassword" resultType="com.lzcc.model.User"> select * from user where username = #{0} and password = #{1};</select>123
2.在dao接口的方法中的參數中添加@param註解
List<User> findByUsernameAndPassword(@Param("username") String username,@Param("password") String password) throws SQLException;1
3.如果上述兩點都正常有可能是springmvc把靜態資源給攔截了。要在springmvc的配置文件中加入以下代碼:
<mvc:resources?location="/images/"?mapping="/images/**"/>?
<mvc:resources?location="/js/"?mapping="/js/**"/>?
<mvc:resources?location="/css"?mapping="/css/**"/>