Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JSP XML Compliant does not display loop results

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Sheriff
Posts: 67651
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic