wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Calling parent tags....... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Calling parent tags......." Watch "Calling parent tags......." New topic
Author

Calling parent tags.......

trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Hi Pals,

Can someone explain me how the parent tags ara called and in which order the body is evaluated??

The answer would be more helpful if someone could refer to HFS page:539.
In the while loop,the value of nestlevel will increase...and since there are 2 nested levels,the value will be 2 and thats printed.
I do not understand why we get all the three outputs??Whats the order in which the parent tags are called here??

I am trying hard to undertand this..but not clear with this concept...

Thanks in advance,

Javainn(SCJP 1.4)
[ April 21, 2005: Message edited by: S javainn ]

Javainn<br /> <br />SCJP,SCWCD,SCBCD,<br />ICED (IBM-287,IBM-484,IBM-486)
IBM certified in DB2 V 8.1 Family Fundamentals (IBM 700)
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Could someone please help me out on this???
chowdary Thammineedi
Ranch Hand

Joined: Aug 16, 2004
Posts: 126
It was intutive for me when I recalled that the setJspBody() method is called prior to the doStartTag() method in a classic tag. And I left it off there.

Also we need to remember that Custom Tag invocations are resolved at Translation time.

From JSP 2.0 spec page 1-151


The first step is to parse the JSP page. The page that is parsed is as expanded
by the processing of include directives. Information in the TLD is used in this
step, including the identification of custom tags, so there is some processing of the
taglib directives in the JSP page.


So do we have to conclude that the inner most tag's doStartTag() method is called first?

I'm not sure, as I've not tested this yet. I'll be coding this during the weekend.

Meanwhile can somebody please explain this.

Where are Jose Esteban, Praveen Kumar and Bassam Zahid?
chowdary Thammineedi
Ranch Hand

Joined: Aug 16, 2004
Posts: 126
By the way I've heard of a Days Inn. (Motel)

Is, Java INN a legitimate Last Name?
Kejal Shah
Ranch Hand

Joined: Jun 27, 2003
Posts: 87
Hi,
Even I was stuck with the same reasoning. However, I later realised that the answer is true.

I don't have the book handy, but the JSP goes something like...

<NestedLevel>
<NestedLevel>
<NestedLevel/>
</NestedLevel>
</NestedLevel>

and in the doStartTag,
1. get the parent and increment a var
2. print the var
3. evaluate the body

So, for the NestedLevel (grandparent), we have the var = 0, it prints, calls the body
for NestedLevel (parent), we have var = 1, it prints, calls the body
for NestedLevel (child), we have var = 2, it prints.

So, the result will be
0
1
2

Hope, I was clear


Kejal<br />SaneDevil@gmail.com
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Hi KejalChowdary and other ranchers,

After breaking my head on this,I could understand how it works..and it matches with what you explained...Thankyou for the effort taken.

Thanks,
Javainn
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling parent tags.......
 
Similar Threads
ejb and resource tags in the deployment descriptor
abstract class
Where is scripting enabled??and where is it disabled?
implementation strategy for a simple ordering application.
Filter Q in HF Book