Forums Register Login

Tag file variable synchronization

+Pie Number of slices to send: Send
In J2EE tutorial pg.595 thru pg.597 about variable synchronization between calling jsp pages and tag files using AT_BEGIN, NESTED, AT_END scope. I still don't quite understand what it means. Can someone explain to me?
Am I going too far in terms of the scope in the exam ?

Thanks
+Pie Number of slices to send: Send
Wow, um (confusing code there) ... it all has to deal with how long variables your tag file creates, stick around.
+Pie Number of slices to send: Send
Found my answer in jsp 2.0spec pg. 1-188: JSP.8.9. It has much better explanation than the tutorial. On top of the confusion, I made a mistake not including core jstl in the directive of the tag file, causing the variable 'x' in tag file to remain unchanged. That even confused me more.

Anyway, the synchronization is always one way, from tag to page. When it occurs depends on the attribute scope you defined in varible directive; AT_BEGIN, NESTED (default), AT_END. Tag file keeps its own copy of the attributes with the same name as the calling page, the container updates/creates/removes the corresponding attributes in the calling page based on what happen in tag file.

In short, attribute directive of tag file acts as IN parameter, from page to tag only. When you need tag file to return something back to the calling page (in other words, OUT parameter), you will need to define scope in variable directive of tag file as AT_BEGIN or AT_END.

Hope I am confusing more people.
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 740 times.
Similar Threads
Headfirst Servlets and Jsp <c:set> pg.457
The attribute directive in tag files.
Example of AT_BEGIN
tag files
Tag file variable question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:35:29.