• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not the expected output: EVAL_BODY_TAG

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here I am again. Still following the PDF book Core Servlets & JavaServer Pages, 1st Ed. I'm having some problem with the output of the following java/jsp/xml codes. I'm expecting that output would be


Simple Loop Tag
Loop max: 3
Hello!Hello!Hello!
End of Counter



but the output of the JSP when excuted is:


Simple Loop Tag
Loop max: 3
End of Counter



This is not what I've expected... thanks again!
more power to all!

jm


 
Author
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raul Martinez:
[QB]Here I am again. Still following the PDF book Core Servlets & JavaServer Pages, 1st Ed. I'm having some problem with the output of the following java/jsp/xml codes. ...


Maybe it's time to buy a book without errors ;-)
The doStartTag() can't return EVAL_BODY_AGAIN. That's a code reserved for the doAfterBody() method. Try returning EVAL_BODY_BUFFERED instead.
 
Raul Martinez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir Hans,
Sorry about the EVAL_BODY_AGAIN... actually I was thinking that I should put EVAL_BODY_INCLUDE. Anyhow, I replaced the EVAL_BODY_AGAIN to EVAL_BODY_BUFFERED
but still the output is


Simple Loop Tag
Loop max: 3
End of Counter


Replacing EVAL_BODY_AGAIN of doStartTag produces this output:


Simple Loop Tag
Loop max: 3 Hello!
End of Counter


still... not the expected output
jm
 
Hans Bergsten
Author
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raul Martinez:
Sir Hans,
Sorry about the EVAL_BODY_AGAIN... actually I was thinking that I should put EVAL_BODY_INCLUDE. Anyhow, I replaced the EVAL_BODY_AGAIN to EVAL_BODY_BUFFERED
but still the output is

still... not the expected output
jm


EVAL_BODY_BUFFERED is the correct value for this example, because the doAfterBody() method reads the value from the buffer. EVAL_BODY_INCLUDE evaluates the body but doesn't buffer it.
After you've changed the tag handler class, make sure you restart the web container (or just the application, if your container supports that), to ensure that you're using the new version of the class. And don't forget to actually install the new version as well ;-) I've spent many hours pulling my hair just to realize that I was still using an old version of a class.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic