jsp 标准 <c:forEach 标签 应用 下拉框

<td width="80px">申报类型</td>
            <td>
                <select name="declarationType" id="">
                    <option value="all" selected="selected">全部</option>
                    <c:forEach var="dept" items="${declarationTypeList}">
                       <option value="${dept.dname}">${dept.dname}</option>
                    </c:forEach>
                </select>
                
            </td>

a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
JS实现年月日第几周下拉框选择时间: ```html <label for="year">年份:</label> <select id="year"></select> <label for="month">月份:</label> <select id="month"></select> <label for="week">第几周:</label> <select id="week"></select> <script> // 获取当前年份 var currentYear = new Date().getFullYear(); // 填充年份下拉框 for (var i = currentYear; i >= 2015; i--) { var option = document.createElement("option"); option.value = i; option.text = i; document.getElementById("year").add(option); } // 填充月份下拉框 for (var i = 1; i <= 12; i++) { var option = document.createElement("option"); option.value = i; option.text = i; document.getElementById("month").add(option); } // 填充第几周下拉框 for (var i = 1; i <= 53; i++) { var option = document.createElement("option"); option.value = i; option.text = i; document.getElementById("week").add(option); } </script> ``` JSP实现年月日第几周下拉框选择时间: ```html <label for="year">年份:</label> <select id="year"> <option value="${currentYear}">${currentYear}</option> <c:forEach begin="2015" end="${currentYear-1}" var="year"> <option value="${year}">${year}</option> </c:forEach> </select> <label for="month">月份:</label> <select id="month"> <c:forEach begin="1" end="12" var="month"> <option value="${month}">${month}</option> </c:forEach> </select> <label for="week">第几周:</label> <select id="week"> <c:forEach begin="1" end="53" var="week"> <option value="${week}">${week}</option> </c:forEach> </select> ``` 其中,`${currentYear}`是JSP中的EL表达式,表示获取当前年份。`<c:forEach>`是JSTL标签库中的循环标签,可以用来生成下拉框的选项。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值