Brett,
Given the example that you provide, I would assume you would have a
getName() and setName() method on your tag class. If your TLD for your tag
specifies these as attributes for the tag/class, the setName() will be
called by the container BEFORE the doStartTag() is called.
Example;
<%-- your jsp --%>
<html>
<% String x = "test" %>
<myTag:set name="<%=x%>"
</html>
// your class
class yourTag
{
String _name = "";
setName(String name)
{
_name = name;
}
doStartTag()
{
// you can now use name as the container has
// already called setName()
System.out.println("name = " + _name);
}
}
HTH,
Bill Pfeiffer
----- Original Message -----
From: "Procek, Brett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 2:43 PM
Subject: pageContext.getAttribute()
Hello,
Is is possible to instantiate a variable or object in a JSP file, then
get that object from within a tag?
Thanks!
For example:
JSP page --------
<html>
String x = "test";
<myTag:set name="x">
</html>
-----------------
Set TAG Implementation -----
doStartTag()
{
?????
pageContext.getAttribute("x")
?????
}
------------------------