Skip to content

Commit

Permalink
Using JSTL for servlet test
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalls-techempower committed May 2, 2013
1 parent abfc207 commit c9e166c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<version>2.1.2</version>
</dependency>

<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- @Inject -->
<dependency>
<groupId>javax.inject</groupId>
Expand Down
12 changes: 7 additions & 5 deletions servlet/src/main/webapp/WEB-INF/jsp/fortunes.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="hello.*,
java.util.*" %><%@ page session="false" %><%
Expand All @@ -15,10 +16,11 @@ List<Fortune> fortunes = (List)request.getAttribute("fortunes");
<th>id</th>
<th>message</th>
</tr>
<% for (Fortune fortune : fortunes) { %><tr>
<td><%= fortune.getId() %></td>
<td><%= Common.render(fortune.getMessage()) %></td>
<c:forEach var="o" items="${fortunes}">
<tr>
<td><c:out value="${o.getId()}" /></td>
<td><c:out value="${o.getMessage()}" /></td>
</tr>
<% } %>
</c:forEach>
</table></body>
</html>
</html>

0 comments on commit c9e166c

Please sign in to comment.