一开始写成了这样:
Page<Market> markets = dao.paginate(pageNumber, 15, "select * ", "from market where cid=? and name like '%?%' order by id asc",cid,marketName);
发生这样的错误:
java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
改成这样:
Page<Market> markets = dao.paginate(pageNumber, 15, "select * ", "from market where cid=? and name like ? order by id asc",cid,"%"+marketName+"%");
结果:顺利解决!!!