Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JSTL example in K&B Book

 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example on page 436. I have set a an array in a servlet like shown below:



Then in the result.jsp I have done below:


But the ouput I get shown is:
<@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Movie List

Im not being shown the list of movies as shown on p 436. Why?
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But the ouput I get shown is:
<@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Movie List


Hi Tontang Bei,

That is because you launched jsp page directly.
Launch the servlet that will set the request attribute and then dispatch
the later job of printing to the jsp page (output rendering).

Thanks,
 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NO,I called the servlet first. Not the JSP.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are jstl.jar and standard.jar include in your library?
If yes, it seems to me, like there is no traversal is happening...
 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes both the jars are included as directed on page 434. but still no luck.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


I think you are missing a % at the beginning

<%@ instead of <@

The missing % makes the text template text and it is rendered as is...
 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANKS Michael. It works now. This is probably the last time I'm going to use notepad again.!!(and code without my glasses )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic