Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HFSJ : page:553 Q:9

 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class bufTag extends BodyTagSupport
{
public int doStartTag() throws JspException {
//INSERT CODE HERE
}
}

Assume that tag has properly Configured to allow body-content.
Which,if inserted at line // would cause jsp code
<mytags:mytag>BodyContent</mytags:mytag>
to output bodyContent?

A. return SKIP_BODY;
B. return EVAL_BODY_INCLUDE
C. return EVAL_BODY_BUFFERED
D. return BODY_CONTENT

they said answer B
but i think answer C

Can anybody exapin me this please.

Thanx
sanjay
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer B is correct.
Only when you return EVAL_BODY_INCLUDE your body will be processed.
You return EVAL_BODY_PROCESSED when you need access to the body for your own manipulation.
Check out the lifecycle chart on HFS page 533.

Regards.
 
Sanjay pts
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You return EVAL_BODY_BUFFERED when you need access to the body for your own manipulation.

I read the same but can u plz tell me which kind of our own manupulations???..
Can u plz expain it me in detail with example
Help will be appriciated.
Thanx in advance
sanjay
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If we return EVAL_BODY_BUFFERED, a new buffer, an instance of body BodyContent is created and is available for further processing. we can simply get writer from the BodyContent object and print the content or make chages in the content.

Thanks
[ June 05, 2005: Message edited by: Narendra Dhande ]
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess both B and C are correct. If you look at the process diagram on page 533, with EVAL_BODY_BUFFERED, after the 2 methods are called, the body is evaluated.
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it, C (EVAL_BODY_BUFFERED) is not really a correct answer because while it might output the body, that really depends on the code written to process the body. And if you go through the extra effort to write that code, chances are you're not going to just take the body and dump it into the output without at least some filtering.

-Yuriy
 
osman cinar eren
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from the jsp spec 13.2.2 :

If EVAL_BODY_BUFFERED is returned, and the custom action element is not
empty, setBodyContent() is invoked, doInitBody() is invoked, the body is evaluated,
doAfterBody() is invoked, and then, after zero or more iterations, doEnd-
Tag() is invoked. If the custom action element is empty, only doStart() and
doEndTag() are invoked.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic