Hai All! I am using following Tag structure in my JSP page. <TAG1> <TAG2> <b>hello</b> <TAG2> <TAG1> My question is it possible to return some return value from TAG1 handler class to TAG2? (Without storing return value in session or request object..) If this is possible pls let me know how to accomplish this? If not pls suggest me any other alternatives..
TIA warm rgds Manohar
Post by:Simon Brown
, Ranch Hand
Hi Manohar, There are a couple of ways in which your two tags can communicate without using the request or session scopes. (1) <TAG1> could introduce a scripting variable into the page (through the PageContext.setAttribute() method), for subsequent use by <TAG2>. (2) <TAG2> could use the getParent() method to get a reference to the actual tag handler class for <TAG1>. Once it has this, you can call any of the methods on the class as normal. Although (2) is useful, it can increase the coupling between your tags. There are ways to reduce this coupling (for example using the findAncestorWithClass method on TagSupport) but I would suggest (1) as being the way to go. Hope that helps. Regards Simon ------------------ Simon Brown Co-author of Professional JSP 2nd Edition [This message has been edited by Simon Brown (edited October 22, 2001).]
Enjoy the full beauty of the english language. Embedded in this tiny ad:
Thread Boost - a very different sort of advertising