Reputation: 531
I have the following code
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSTL</title>
</head>
<body>
<c:forTokens items="Zara,nuha,roshy" delims="," var="name">
<c:out value="${name}"/><p>
</c:forTokens>
</body>
</html>
When I run it, I am getting a blank page. Whats wrong with my code?
Upvotes: 0
Views: 143
Reputation: 692081
You forgot to declare the core taglib at the top of the page. Look at the generated HTML code, and you'll see <c:forTokens>
and <c:out>
verbatim in the generated HTML code, which is an indication that the JSP container considered them as pure text, and not as JSP tags.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
And you also forgot to add the jar(s) of the JSTL in your webapp. Follow the instructions of the JSTL tag info page.
Upvotes: 2