jstl标签<c:url>查询分页时拼接参数的用法

来源:互联网 发布:手机wifi热点软件 编辑:程序博客网 时间:2024/06/16 00:59

先上代码:

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%><c:set var="ctx">${ pageContext.request.contextPath }</c:set><html><head><title>号码段管理</title></head><body><content tag="breadcrumb-list"><li class="active">号码段管理</li></content><div class="panel panel-default"><div class="panel-heading"><span class="h3"><i class="icon-table icon-large"></i> 号码段管理</span><div class="space-4"></div><form class="form-inline" role="form" id="search-form"><div class="form-group"><label for="q-form-username">区域号</label> <input type="text"class="form-control" id="seg_code" name="seg_code"value="${param.seg_code }" placeholder="区域号"></div><div class="form-group"><label for="q-form-username">号段</label> <input type="text"class="form-control" id="seg_num" name="seg_num"value="${param.seg_num }" placeholder="号段"></div><button type="submit" class="btn btn-info btn-sm"><i class="icon-search"></i> 查询</button><button id="save-btn" type="button" onclick="save()" class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-plus"></span> 新增</button></form></div><div class="table-responsive"><table id="mainTable"class="table table-striped table-bordered table-hover"><thead><tr><th class="center">区域号</th><th>号段</th><th>省</th><th>市</th><th>运营商</th><th>操作</th></tr></thead><tbody><c:forEach items="${page.list}" var="item"><tr><td class="center">${item.segCode }</td><td>${item.segNum }</td><td>${item.provinceName }</td><td>${item.cityName }</td><td><c:if test="${item.operator.value==1 }">${item.operator.desc }</c:if> <c:if test="${item.operator.value==2 }">${item.operator.desc }</c:if> <c:if test="${item.operator.value==3 }">${item.operator.desc }</c:if></td><td><a class="green"href="${ctx }/mobileseg/modifyskip/${item.id}"> <iclass="icon-pencil bigger-130"></i></a> <a class="red"onclick="javascript:$.opRecord('确认删除号码段?', '${ctx }/mobileseg/delete/${item.id }');"><i class="icon-trash bigger-130"></i></a></td></tr></c:forEach></tbody></table><div class="text-center"><!-- 注意这块代码 --><c:url var="url" value=""><c:param name="seg_code">${param.seg_code }</c:param><c:param name="seg_num">${param.seg_num }</c:param></c:url><jsp:include page="/WEB-INF/jsp/pager/simple.jsp"><jsp:param name="url" value="${url }" /></jsp:include></div></div></div><script>var flushMessage = '${message}';</script><content tag="javascript-block"> <script>jQuery(function($) {//操作消息if (flushMessage) {$.showTip("info", flushMessage);}$.showLeftMenu("${ctx}/mobileseg/index");});function save(){window.location.href="${ctx}/mobileseg/saveskip";}</script></content></body></html>
注意上面<div class="text-center">中的代码
<c:url>中设置了两个<c:param>参数,这两个参数为上面查询条件,区域号和号段,下面<jsp:include>中引入的simple.jsp为分页界面(用来显示上一页、下一页,页码),这样设置的好处是,点击查询按钮时,form表单提交到默认的Url路径下,查询的参数自动拼在url后面,这样点击下一页时,pageNum和查询条件可以直接拼在url后面,从而不会让查询参数遗失导致分页显示内容错误。


阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 电子手表不显示怎么办 电子手表不用时怎么办 电子表指针掉了怎么办 支付宝还款失败怎么办 误把转到借记卡怎么办 余额宝转账限额怎么办 市民卡充值的钱怎么办 电信卡过期了怎么办 支付宝身份验证失败怎么办 财付通自己扣钱怎么办 车子罚单丢了怎么办 贷款绑卡失败怎么办 身份证被绑定了怎么办 身份证绑了五个怎么办 工行账户冻结了怎么办 qq余额忘记使用怎么办? 电话诈骗转账后怎么办 淘宝手机号没了怎么办 qq支付超过限额怎么办 qq20w限额满了怎么办 微信没有钱包怎么办 qq交易额度超额怎么办 银行卡转不出钱怎么办 qq钱包交易受限怎么办 qq红包交易限制怎么办 微信借钱被删后怎么办 dnf点券充错号了怎么办 点读笔笔头不读怎么办 q币被骗了怎么办 充值q币被骗怎么办 刷q币被骗怎么办? 腾讯客服打不通怎么办 微信中q币充错了怎么办 app退款一直失败怎么办 手机流量卡顿怎么办 微信手机充值是空号怎么办 qq被黑名单了怎么办 qq被拉黑怎么办再联系 qq黄钻超额怎么办 微信充值流量不到账怎么办 电脑qq动不了怎么办