Win a copy of Java Challengers this week in the Java in General 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Using JSTL example in K&B Book

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes both the jars are included as directed on page 434. but still no luck.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 )
 
Paper beats rock. Scissors beats tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic