aspose file tools*
The moose likes JSP and the fly likes Not the expected output: EVAL_BODY_TAG Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Not the expected output: EVAL_BODY_TAG" Watch "Not the expected output: EVAL_BODY_TAG" New topic
Author

Not the expected output: EVAL_BODY_TAG

Raul Martinez
Greenhorn

Joined: Mar 01, 2004
Posts: 17
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


Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
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.


Hans Bergsten, hans@gefionsoftware.com<br />Author of O'Reilly's<br />- JavaServer Pages,<br />- JavaServer Faces<br /><a href="http://www.hansbergsten.com/" target="_blank" rel="nofollow">http://www.hansbergsten.com/</a>
Raul Martinez
Greenhorn

Joined: Mar 01, 2004
Posts: 17
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
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
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.
 
wood burning stoves
 
subject: Not the expected output: EVAL_BODY_TAG
 
Similar Threads
Custom tag question:
Custom Tags - Repeating Tags
JSP Tags - Attributes passed returns NULL [SOS Please help]
Not a valid tag lib
Tag library problem ...