生活随笔
收集整理的這篇文章主要介紹了
JSTL标签显示动态控件
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
項(xiàng)目中有一個(gè)頁(yè)面,控件的個(gè)數(shù)是不確定的
選擇的業(yè)務(wù)對(duì)象不同,需要的控件個(gè)數(shù)不同,根據(jù)后臺(tái)返回的數(shù)據(jù),顯示頁(yè)面控件
用JSTL循環(huán)實(shí)現(xiàn),樣式是設(shè)計(jì)好的,每一行3個(gè)控件
<
div class=
"searchStyle"><
div class=
"searchTitleStyle"><button
class=
"searchTitleFontStyle">其他信息</button></
div><
div class=
"searchContentStyle"><%<c:
set var=
"total" value=
"0"/><c:forEach items=
"${sbimds}" var=
"t" varStatus=
"status"><c:
set var=
"total" value=
"${status.index+1}"/></c:forEach><%<c:
set var=
"outForeachNumber" value=
"${Math.ceil(total / 3)}"/><%<c:forEach var=
"i" begin=
"1" end=
"${outForeachNumber}" varStatus=
"statusOut"><c:
set var=
"nowNumber" value=
"${statusOut.index}"/><c:choose><c:when test=
"${nowNumber==1}"><
div class=
"searchContentRowTopStyle"><
div class=
"boxStyle rowleft"></
div><%<c:forEach items=
"${sbimds}" var=
"t" varStatus=
"statusTop"><c:
set var=
"frontIndex" value=
"${statusTop.index+1}"/><c:
if test=
"${frontIndex<=3}"><%<c:
if test=
"${t.dataInputTypeEnum.value eq 3}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls" title=
"請(qǐng)選擇"><select
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"class=
"inputStyle"><c:forEach items=
"${t.comboDatas}" var=
"map1"><c:forEach items=
"${map1}" var=
"c"><option value=
"${c.key}" ${c.key eq m.customerId?'selected=
"selected"':''}>${c.value}</option></c:forEach></c:forEach></select></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '2'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls input-append date"><input
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"data-format=
"yyyy-MM-dd hh:mm:ss"data-position=
"bottom-left"placeholder=
"請(qǐng)選擇時(shí)間"cssClass=
"validate[required]"class=
"inputStyle"/><span
class=
"add-on"><i data-
time-icon=
"icon-time"data-
date-icon=
"icon-calendar"></i></span></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '1' and t.dataInputTypeEnum.value ne '3'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls"><input type=
"number" id=
"ext.${t.sampBizFieldCode}"name=
"ext.${t.sampBizFieldCode}"step=
"0.01" class=
"inputStyle"/></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '0' and t.dataInputTypeEnum.value ne '3'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls"><input
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"type=
"text"class=
"inputStyle"/></
div></c:
if></c:
if></c:forEach><
div class=
"rowright"></
div></
div></c:when><c:otherwise><
div class=
"searchContentRowMiddleStyle"><
div class=
"boxStyle rowleft"></
div><%<c:
set var=
"beginIndex" value=
"${nowNumber*3-2}"/><c:
set var=
"endIndex" value=
"${nowNumber*3}"/><c:forEach items=
"${sbimds}" var=
"t" varStatus=
"statusMiddle"><c:
set var=
"frontIndex" value=
"${statusMiddle.index+1}"/><c:
if test=
"${frontIndex>=beginIndex && frontIndex<=endIndex}"><%<c:
if test=
"${t.dataInputTypeEnum.value eq 3}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls" title=
"請(qǐng)選擇"><select
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"class=
"inputStyle"><c:forEach items=
"${t.comboDatas}" var=
"map1"><c:forEach items=
"${map1}" var=
"c"><option value=
"${c.key}" ${c.key eq m.customerId?'selected=
"selected"':''}>${c.value}</option></c:forEach></c:forEach></select></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '2'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls input-append date"><input
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"data-format=
"yyyy-MM-dd hh:mm:ss"data-position=
"bottom-left"placeholder=
"請(qǐng)選擇時(shí)間"cssClass=
"validate[required]"class=
"inputStyle"/><span
class=
"add-on"><i data-
time-icon=
"icon-time"data-
date-icon=
"icon-calendar"></i></span></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '1' and t.dataInputTypeEnum.value ne '3'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls"><input type=
"number" id=
"ext.${t.sampBizFieldCode}"name=
"ext.${t.sampBizFieldCode}"step=
"0.01" class=
"inputStyle"/></
div></c:
if><%<c:
if test=
"${t.sampBizFieldTypeEnum.value eq '0' and t.dataInputTypeEnum.value ne '3'}"><
div><label path=
"" class=
"labelStyle">${t.sampBizFieldTitle}:</label></
div><
div class=
"controls"><input
id=
"ext.${t.sampBizFieldCode}" name=
"ext.${t.sampBizFieldCode}"type=
"text"class=
"inputStyle"/></
div></c:
if></c:
if></c:forEach><
div class=
"rowleft"></
div></
div></c:otherwise></c:choose></c:forEach></
div>
</
div>
總結(jié)
以上是生活随笔為你收集整理的JSTL标签显示动态控件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。