首先给我们的项目添加需要的 配置文件
先在显示的主界面的jsp中添加按钮
<tr>
<td colspan=\"11\">
<form action=\"list\" method=\"post\">
<input type=\"hidden\" name=\"page\" id=\"page\">
<input type=\"text\" name=\"mohu\">
<input type=\"submit\" value=\"查询商品\">
</form>
</td>
</tr>
<tr>
<td colspan=\"11\">
<input type=\"button\" value=\"首页\" =\"fenye(1)\">
<input type=\"button\" value=\"上一页\" =\"fenye(${pg.prevpage})\">
<input type=\"button\" value=\"下一页\" =\"fenye(${pg.nextpage})\">
<input type=\"button\" value=\"末页\" =\"fenye(${pg.countpage})\">
</td>
</tr>
function fenye(page){
document.getElementById(\"page\").value=page;
document.forms[0].submit();
}
返回我们的控制层去编写
@RequestMapping(“list”)
public String list(HttpServletRequest request,String page,String mohu) {
mohu=mohu==null?\"\":mohu;
int count=mapper.count(mohu);
PageUtil pg = new PageUtil(page, 3, count);
pg.setMohu(mohu);
pg.setPagesize(pg.getDangqianye()*3);
List<Er> list=mapper.list(pg);
request.setAttribute(\"list\", list);
request.setAttribute(\"mohu\", mohu);
request.setAttribute(\"pg\", pg);
return \"list\";
}
接入到操作层去
@Select(“select * from er where ename like concat(’%’,#{mohu},’%’) limit #{shoucanshu},#{pagesize}”)
List list(PageUtil pg);
@Select(“select count(*) from er where ename like concat(’%’,#{mohu},’%’)”)
int count(String mohu);
继续阅读与本文标签相同的文章
下一篇 :
高红冰:新四大发明彰显互联网普惠价值
-
网站渗透测试服务项目内容详情
2026-05-18栏目: 教程
-
来杭州云栖大会,全面了解企业如何实现云上IT治理
2026-05-18栏目: 教程
-
2019「边缘计算」大看点,点击解锁详细版云栖大会参会指南
2026-05-18栏目: 教程
-
生存还是毁灭?一文读懂挖矿木马的战略战术
2026-05-18栏目: 教程
-
数据库基础技术实践#网络安全基础技术实践课程
2026-05-18栏目: 教程
