jsp页面中c标签 运用
2016-06-04 14:43
288 查看
jsp页面中c标签 forEach、forTokens when choose if 与 input 【text,radio】select的综合运用
<1> html代码
<div style="display: ${empty mapList ? "none":""}" id="TestForEach"> <div> <ul style="margin-left: 100px"><li class="active" style="list-style: none;"><b style="font-size: 18px">显示text或select</b></li></ul> <div > <c:if test="${not empty mapList}"> <c:forEach var="map" items="${mapList}"> <c:forEach items="${map}" var="map" > <c:if test="${not empty list}"> <c:forEach var="list" items="${list}"> <input id="map" type="hidden" value="${list.mapId}"/> <c:if test="${map.key eq list.mapId}"> <ul class="nav nav-tabs"> <li>${list.name} </li> <c:choose> <c:when test="${fn:contains(list.afterValue,',')}"> <select id="${list.mapId}"> <c:forTokens items="${list.afterValue}" delims="," var="afterValue"> <c:choose> <c:when test="${afterValue eq map.value}"> <li><option value="${afterValue}" selected="selected">${afterValue}</li> </c:when> <c:otherwise> <li><option value="${afterValue}">${afterValue}</li> </c:otherwise> </c:choose> </c:forTokens> </select> </c:when> <c:otherwise> <li><input id="${list.mapId}" type="text" data="show" value="${map.value}"/></li> </c:otherwise> </c:choose> </ul> </c:if> </c:forEach> </c:if> </c:forEach> </c:forEach> </c:if> </div> </div> <div style="display: ${empty mapList ? "none":""}" id="TestForTokens"> <ul><li class="active" style="list-style: none;"><b style="font-size: 18px">显示radio</b></li></ul> <c:if test="${not empty mapList}"> <c:forEach var="map" items="${mapList}"> <c:forEach var="map" items="${map}"> <c:if test="${not empty list}"> <c:forEach var="list" items="${list}" varStatus="count"> <input id="map" type="hidden" value="${list.mapId}"/> <c:if test="${map.key == list.mapId}"> <ul class="nav nav-tabs"> <li>${list.name} </li> <c:if test="${not empty list.afterValue}"> <c:forTokens items="${list.afterValue}" delims="," var="afterValue"> <c:choose> <c:when test="${map.value eq afterValue}"> <li><input id="${list.mapId}" type="radio" sel="sel" name="${count.index}" value="${afterValue}" checked="checked">${afterValue} </li> </c:when> <c:otherwise> <li><input id="${list.mapId}" type="radio" name="${count.index}" sel="sel" value="${afterValue}">${afterValue} </li> </c:otherwise> </c:choose> </c:forTokens> </c:if> </ul> </c:if> </c:forEach> </c:if> </c:forEach> </c:forEach> </c:if> </div> </div>
<2>在js中获取标签中的值
function getValue(){ var Input = $("#TestForEach input[data='show']").map(function(){ return $(this).attr("id")+"="+$(this).val(); }).get().join("|"); var Select = $("#TestForEach select").map(function(){ return $(this).attr("id")+"="+$(this).val(); }).get().join("|"); alert(Input+"|"+Select); var radio=$("#TestForTokens :radio[checked='checked']").map(function(){ return $(this).attr("id")+"="+$(this).val(); }).get().join("|"); alert(radio); }
相关文章推荐
- JSP/PHP基于Ajax的分页功能实现
- 开发阶段Jetty运行Jsp报错且响应空白
- jsp简单实现页面之间共享信息的方法
- Apache Web让JSP“动”起来
- JSP学习经验小结分享
- JSP 多条SQL语句同时执行的方法
- 在jsp页面中响应速度提高的7种方法分享
- (jsp/html)网页上嵌入播放器(常用播放器代码整理)
- 使用JSP制作一个超简单的网页计算器的实例分享
- JSP上传excel及excel插入至数据库的方法
- 浅析JSP的9大内置对象和4大作用域对象
- JSP中文乱码常见3个例子及其解决方法
- jsp实现将动态网页转换成静态页面的方法
- JSP避免Form重复提交的三种方案
- 纯jsp实现的倒计时动态显示效果完整代码
- JSP自定义标签入门学习
- JSP实现添加功能和分页显示实例分析
- JSP中param标签用法实例分析