commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Nichols <nx10m...@yahoo.co.uk>
Subject [jelly] How does context inheritance work?
Date Mon, 13 Jan 2003 13:53:13 GMT
Hi,

I'm having difficulty understanding what JellyContext.setInherit() 
accomplishes. In a custom tag library I have TagSupport-derivatives : e.g., 
given
<doc>
   <my:a>    <!-- maps to TagA -->
     <my:b/>    <!-- maps to TagB -->
   </my:a>
   <my:c/>    <!-- maps to TagC -->
</doc>

In TagA.doTag() :
...
getContext().setVariable ("monday", "blue");
...

In TagB.doTag() :
System.out.println (getContext().getVariable ("monday"));

This currently prints "blue" - in other words, a context var set in one tag 
is visible in the context of a child tag. Great!
FWIW, this was _not_ working until I started using CVS HEAD instead of a 
snapshot.

Now my confusion starts. Although getContext().getInherit() returns true, 
adding getContext().setInherit (false) to either (or both) doTag() methods 
seems to have no effect on this behaviour. This is what I had expected from 
findVariable() -- but not from getVariable(). What am I misunderstanding? 
Will this same context be visible in TagC?


This is all driven using a modified EmbeddedJelly.java, running CVS HEAD on 
a Linux / JDK 1.3.1 platform.

Suffice to say that Jelly is stonkingly good, I expect it imminently to 
achieve world domination. Many thanks for the diligent labours involved.

Yours aye,
Thomas.


Mime
View raw message