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

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

先上代码:

<%@ 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博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 中国银行三亲见怎么办 农行怎么办信用卡时间 淘宝群聊进不去怎么办 退货拒收怎么办 卖房无购房发票怎么办 苹果官网进不了怎么办 applepencil太滑怎么办 娇兰官网下单只有订单号怎么办 民心网不满意怎么办 订单推送不正常怎么办 12306看不到订单怎么办 享换机逾期怎么办 花呗忘了分期怎么办 莆田农保卡怎么办 社保几个月没交怎么办 派派提不了现怎么办 派派提现不到账怎么办 小米手环难带怎么办 纯棉运动裤掉色怎么办 孕妇轻微咳嗽怎么办 阔腿裤显肚子怎么办 单鞋买小码了怎么办 面包服变塌了怎么办 爱居兔加盟亏本怎么办 京东店没有销量怎么办 洗窗帘扣环怎么办 窗帘杆孔打错了怎么办 窗帘杆孔打低了怎么办 手机停卡后话费怎么办 acc无法激活怎么办 打印机找不到驱动程序怎么办 itunes跑流量怎么办 wlan开不到怎么办? 魅族note3发烫怎么办 魅蓝触屏没反应怎么办 淘宝刚买就降价 怎么办 魅族手环进水了怎么办 没有鸡蛋分离器怎么办 手被晒得很黑怎么办 微店卖家不发货怎么办 微店被资金冻结怎么办