Confusing on the page contexts of tag file and its calling page
Hello,
I read somewhere that for a tag file, its page context is different from the page context of the calling page. For example:
if in the tag file (suppose the tag name is sample, prefix is java), I am writing like that:
<%-- set the page scope message with value hello world
the message is not defined as a variable --%>
<c:set var="message" value="hello world" />
then in the calling page, if it is like:
<java:sample>
<%-- no output here--%>
${message}
</java:sample>
we will not get out put as "hello world" since those two have differnet page context.
But what confuses me is that, if I rewrite the sample tag using tag handler, and in its doTag() method, I set the message as the hanlder's page context attribute:
public class Sampletag extends SimpleTagSupport{
public void doTags(){
..
this.getjspContext().setAttribute("message", "hello world");
..
}
}
then, this attribute is VISIBLE to the calling page.
So my understanding is:
for tag file, calling page and tag file use different page contexts
for tag handler, calling page and tag file use same page context
Am I correct?
Thanks!

