• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag file variable synchronization

 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, um (confusing code there) ... it all has to deal with how long variables your tag file creates, stick around.
 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic