jstl中定义String数组
来源:互联网 发布:java枚举有什么用 编辑:程序博客网 时间:2024/06/06 22:45
有人提出了个这个问题,想了半天可以使用fn函数实现
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="arrayvalue" value="0,1,10,15,20" />
<c:set var="delim" value=","/>
<c:set var="array" value="${fn:split(arrayvalue, delim)}"/>
<table border="1" align="center">
<tr><td>A</td><td>B</td></tr>
<c:forEach var="i" begin="0" end="5">
<tr>
<td><c:out value="${i}"/></td>
<td>
<c:out value="${array[i]}"/>
</tr>
</c:forEach>
</table>
如果不能使用fn函数就麻烦了
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% int[] arrayvalue={0,1,5,10,15,88};%>
<table border="1" align="center">
<tr><td>A</td><td>B</td></tr>
<c:forEach var="i" begin="0" end="5">
<tr>
<td><c:out value="${i}"/></td>
<td>
<% Integer j=(Integer)pageContext.getAttribute("i"); %>
<%= arrayvalue[j.intValue()] %></td>
</tr>
</c:forEach>
</table>
本文出处不详,引用再次转载地址:
http://changfei0216.blog.hexun.com/6717281_d.html
- jstl中定义String数组
- java中数组定义String a[]和String[] a有什么区别?
- C#中定义数组
- C#中定义数组
- freemarker中定义数组
- shell 中定义数组
- C++ String数组的定义问题
- 【c++】用string类定义字符串数组
- C++用string 定义字符串数组
- 【C++】 用string类定义字符串数组
- 在jsp中使用JSTL定义的变量
- c# int数组与string数组一样定义
- C#中如何定义数组
- javascript中数组的定义
- C++中定义字符串数组
- javascript中数组的定义
- javascript中数组的定义
- java中数组的定义
- 学习规划
- 使用HashSet获取两个List的并集
- VS2010用C#写单元测试的一些总结
- HashSet和TreeSet
- 海量数据库的查询优化及分页算法方案
- jstl中定义String数组
- 聊胜于无 Java之唯一无序数生成
- 快速学习AJAX之三 Ajax实现登陆
- 角度的选择
- Android:在WebView中获取网页源码
- 在计算机中NIC是什么意思?
- MATLAB中freqz函数的用法
- java 原码、反码、补码
- ArcGIS 中的网络 Geometric Networks 和 Network Datasets