You are setting the variable (in your doStartTag method) with
APPLICATION_SCOPE, and retrieving it with PAGE_SCOPE (that's the default).
So you're putting it one place and looking another. Application Scope
(which isn't used very much) is kind of like a static variable in Java, it
makes a single value available to all running instances of the JSP, you
probably want to change the code in your doStartTag to use
PageContext.PAGE_SCOPE (if you need it for this run through the page) or
SESSION_SCOPE (If this user should always get these values). The other
option is to either specify the Scope to the getAttribute() call in your TEI
Class or use findAttribute (which searches all scopes).
(*Chris*)
----- Original Message -----
From: "cbarnes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 13, 2001 9:00 AM
Subject: [JSP-INTEREST] TagExtraInfo.getVariableInfo
> I want to be able to create a variable in a custom tag and make this
> variable available in the JSP the tag was called from.
>
> To do this I added the following line to the doStartTag (or doEndTag)
method
> in the custom tag.
> pageContext.setAttribute("myvariable", myvariable,
> PageContext.APPLICATION_SCOPE);
>
> I then created a TagExtraInfo class that looked similar to the following
> (this class was added to the tld file):
>
> public class myTEI extends TagExtraInfo
> {
> public VariableInfo[] getVariableInfo(TagData data)
> {
> String name = data.getAttributeString("name");
> String type = data.getAttributeString("type);
>
> VariableInfo[] scriptvars = new VariableInfo[1];
> scriptvars[0] = new
> VariableInfo(name,type,true,VariableInfo.AT_BEGIN);
>
> return scriptvars;
> }
> }
>
> The problem with this is that in getVariableInfo the values of name and
> type are null.
> Can anyone tell me if the problem is with the line of code where I add the
> variable to the pageContext or with the TEI class and how I can fix this?
>
> Thanks,
> Catharine
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets