如何在Eclipse使用jstl标签
2个回答
展开全部
首先下载jstl.jar和standar.jar
2.在你web.xml中加入
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</jsp-config>
3.在jsp页面可以进行调用:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<table border="1" width="80%" align="center">
<tr>
<td>序号</td>
<td>姓名</td>
<td>密码</td>
<td>邮件</td>
</tr>
<c:forEach items="${list}" var="dto" varStatus="statu" >
<c:choose>
<c:when test="${statu.index%2==0}">
<tr bgcolor="red">
<td>${statu.count}</td>
<td>${dto.username}</td>
<td>${dto.password}</td>
<td>${dto.email }</td>
</tr>
</c:when>
<c:otherwise>
<tr>
<td>${statu.count}</td>
<td>${dto.username}</td>
<td>${dto.password}</td>
<td>${dto.email }</td>
</tr>
</c:otherwise>
</c:choose>
2.在你web.xml中加入
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</jsp-config>
3.在jsp页面可以进行调用:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<table border="1" width="80%" align="center">
<tr>
<td>序号</td>
<td>姓名</td>
<td>密码</td>
<td>邮件</td>
</tr>
<c:forEach items="${list}" var="dto" varStatus="statu" >
<c:choose>
<c:when test="${statu.index%2==0}">
<tr bgcolor="red">
<td>${statu.count}</td>
<td>${dto.username}</td>
<td>${dto.password}</td>
<td>${dto.email }</td>
</tr>
</c:when>
<c:otherwise>
<tr>
<td>${statu.count}</td>
<td>${dto.username}</td>
<td>${dto.password}</td>
<td>${dto.email }</td>
</tr>
</c:otherwise>
</c:choose>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询