Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP XML Compliant does not display loop results

 
Clinton Morrison
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When the results page is being displayed it does not display the results for ${animals}. It just outputs Could be:. However when I convert it back to a standard jsp it displays ${animals}. I am using Tomcat and jsp version 2.0.

Thanks in advance
Clinton

*results.jsp*
<html xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
<title>Animal Results</title>
</head>
<body>
<h1>Animal Recommendations JSP</h1>
<table>
<c:forEach var="animals" items="${results}">
<tr>
<td>Could be:<jsp:text>${animals}</jsp:text></td>
</tr>
</c:forEach>
</table>
</body>
</html>

*index.jsp*
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Animal Selection Page</title>
</head>
<body>
<h1 align="center">Animal Selection Page</h1>
<form method="POST" action="SelectAnimal.do">Select animal
characteristics
<p>Color:</p>
<select name="color" size="1">
<option>white</option>
<option>brown</option>
<option>green</option>
<option>orange</option>
</select> <br />
<br />
<center><input type="submit" value="Submit" /></center>
</form>
</body>
</html>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you be using the JSP Document Format (XML) instead of the "normal" syntax? The Doc syntax is not intended for hand coding. The markup requirements are too stringent and it's easy to run afoul of them -- as you have discovered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic