• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classic tags

 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In classic tag API, If we return a un know retrun value from a specific method what will happened.

Example if we return the EVAL_PAGE from doAfterBody() method, what will happen, will it be runtime Exception?
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In classic tag API, If we return a unknown retrun value from a specific method what will happened.


I think it will give the unconsistent behaviour.



I have run the program , the body has been proessed perfectly.

From my findings ,

if doStartTag returns other than SKIP_BODY , the container is trying to execute the doAfterBody method.

if doEndTag returns other than SKIP_PAGE , the container is evaluating the rest of the JSP page.

if doAfterBody any int value , doEndTag has been called.

Please correct me if somebody found something.

Note: I didnt get any Runtime Exception.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Deepa raj, great info
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes deepa. even I tried the same. But in enthuware mock exam its given runtime exception will be thrown.

Srividhya
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the point here is that this behaviour is undefined by the JSP specification (which assumes you would always use a valid constant - naturally Java 5 enums would avoid the problems!) Although one container might assume a value, another might throw an exception, or log an error, or do nothing etc. The SCWCD exam won't ask you about such undefined container-specific problems.
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks charles
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Charles Lyons:
I think the point here is that this behaviour is undefined by the JSP specification (which assumes you would always use a valid constant - naturally Java 5 enums would avoid the problems!) Although one container might assume a value, another might throw an exception, or log an error, or do nothing etc. The SCWCD exam won't ask you about such undefined container-specific problems.


Are you sure this is a container issue? The TagSupport class is just a class..

Who's the author of the classes in the javax.servlet packages? Sun?
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure this is a container issue? The TagSupport class is just a class..
Yes, but it is the container that decides what to do with the return values from the methods in TagSupport, or from any class implementing any of the tag interfaces or extending any of the tag classes. The container provides the code that actually does the iteration of a IterationTag and supplies the body content to a BodyTag, for example.
Who's the author of the classes in the javax.servlet packages? Sun?
Yes, but those classes only implement the contract of the appropriate interfaces and return default values - they don't actually do anything useful by themselves. The "doing" is performed by the container, hence the behaviour when your implementation returns an unexpected value is vendor-dependent (since I do not believe it is defined in the specifications).
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crystal. Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic