Wednesday, November 13, 2013

JSTL Example


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored ="false" %>

<table>
<tr>
    <th>UserId</th>
    <th>Name</th>
</tr>
    <c:forEach var="user" items="${ALLUSERLIST}">
    <tr>
        <td><c:out value="${user.userId}"/></td>
        <td><c:out value="${user.personName}"/></td>
    </tr>
</c:forEach>
</table>

<c:set var="salary" scope="session" value="${2000*2}"/>
<c:if test="${salary > 2000}">
   <p>My salary is: <c:out value="${salary}"/><p>
</c:if>

===============
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
================

No comments:

Post a Comment