This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using JSTL example in K&B Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Using JSTL example in K&B Book" Watch "Using JSTL example in K&B Book" New topic
Author

Using JSTL example in K&B Book

Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
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

Joined: Feb 28, 2007
Posts: 1707

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,


cmbhatt
Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
NO,I called the servlet first. Not the JSP.
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
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

Joined: Oct 21, 2006
Posts: 130
Yes both the jars are included as directed on page 434. but still no luck.
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
<@ 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

Joined: Oct 21, 2006
Posts: 130
THANKS Michael. It works now. This is probably the last time I'm going to use notepad again.!!(and code without my glasses )
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using JSTL example in K&B Book
 
Similar Threads
c:forEach tag
Why this uri cannot be resolve for jstl example?
JSTL does not show values
how to get jstl working
help-standard tag c:forEach practice