当前位置:网站首页>解决Jsp级联问题
解决Jsp级联问题
2022-07-27 16:11:00 【程序员柒七】
jsp中级联查询用用到的地方很多,下面是我在项目中用的的一种写法,分享给大家。
查询条件根据省份的改变级联城市。
JSP页面
<select name="provinceId" class="input-text w-200" id="provinceId" onchange="changeProvince()">
<option value="">请选择省份</option>
<c:forEach items="${provinceList}" var="bean">
<option value="${bean.id}"
<c:if test="${provinceId==bean.id }">selected</c:if>>${bean.province}</option>
</c:forEach>
</select>
<select name="areaId" class="input-text w-200" id="areaId">
<option value="">请选择城市</option>
<c:forEach items="${cityList}" var="c">
<option value="${c.id }"
<c:if test="${areaId==c.id }">selected</c:if>>${c.city }</option>
</c:forEach>
</select>JQurey函数:
function changeProvince() {
$("#areaId").find("option").remove();
var provinceId = $("#provinceId").val();
$.get('${ctx}/admin/area/lists.action', {parentId: provinceId, level: 2}, function (result) {
var html = '';
html += '<option value="">请选择城市</option>';
for (var i = 0; i < result.data.length; i++) {
var bean = result.data[i];
var button = '';
html += '<option <c:if test="${areaId==bean.id }">selected</c:if> value="' + bean.id + '">' + bean.name + '</option>';
}
$("#areaId").html(html)
})
}
原文链接:https://blog.csdn.net/duyusean/article/details/81436286
边栏推荐
- Zhanrui fresh seedlings: enable full scene applications, and massive data needs the integration of AI and IOT
- 2021.7.31笔记 视图
- 微信小程序获取手机号
- MySQL学习 Day2 排序查询 / 聚合函数 /分组查询 /分页查询 /约束/多表之间的关系
- [mit 6.s081] LEC 1: introduction and examples notes
- Announcing the acquisition of 30% shares of Wenye, what is the general intention of Dalian United?
- [MIT 6.S081] Lab 4: traps
- 微信小程序 wxacode.getUnlimited生成小程序码
- 小米CC9 Pro拆解:后置五摄成本是骁龙855数倍!
- [MIT 6.S081] Lab 6: Copy-on-Write Fork for xv6
猜你喜欢

C杂讲 链表初讲

Deep learning - paper reading: action structural graph convolution network as-gcn
![[MIT 6.S081] Lec 6: Isolation & system call entry/exit 笔记](/img/b3/89b3688a06aa39d894376d57acb2af.png)
[MIT 6.S081] Lec 6: Isolation & system call entry/exit 笔记

2. Change color space and color detection

2021.8.9笔记 request
![[MIT 6.S081] Lab 5: xv6 lazy page allocation](/img/f6/8b619412bc6ba425d0f04629917e80.png)
[MIT 6.S081] Lab 5: xv6 lazy page allocation

Linked list storage structure of dynamic linked list 2 stack (linkedstack Implementation)

How do corporate giants such as Schneider Electric and L'Oreal make open innovation? Uncover secrets of demo World Innovation Summit

微信小程序获取openId, sessionKey, unionId

1. OpenCV image basic operation
随机推荐
发布自己的npm组件库
[MIT 6.S081] Lab 10: mmap
Here comes the first 5g SOC of MediaTek! A77+g77+apu3.0, officially released on November 26!
[MIT 6.S081] Lab 11: networking
2021.7.30笔记 索引
浅谈AI深度学习的模型训练和推理
深度学习-论文阅读:动作结构性图卷积网络AS-GCN
2021.8.6笔记 jsoup
动态链表3队列的链式存储结构(LinkedQueue实现)
[MIT 6.S081] Lab 6: Copy-on-Write Fork for xv6
力压谷歌、英伟达!阿里含光800芯片再获权威测试世界第一
@Considerations for query of convert annotation in JPA
Deep learning: stgcn learning notes
[MIT 6.S081] Lab 3: page tables
输入框blur事件与click事件冲突问题
2021.7.31笔记 视图
uniapp H5跨域问题
How do corporate giants such as Schneider Electric and L'Oreal make open innovation? Uncover secrets of demo World Innovation Summit
Deep learning: GCN (graph convolution neural network) theory learning summary
联发科首款5G SoC来了!A77+G77+APU3.0,11月26日正式发布!