You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Den Riabtchik <pa...@home.com> on 2000/04/13 03:22:57 UTC

Scripting variable name

Hello!

According to JSP 1.1 spec when I try to declare a custom tag and specify
an "id" attribute the JSP translator should create a scripting variable
with appropriate name. But it seems to me that this feature is not
supported in current version of Tomcat - all scripting variables have
autogenerated names like "_jspx_th_" + unique id. 
Below there is an abstract from JSP 1.1 spec and it seems to me that it
states that it is possible to specify the name of a scripting variable.

Best regards,
Den Riabtchik

-----------------
5.1.3.2 Call Functionality, No Body, Define Object
In a simple variation of the previous example the action defines an
object.
<x:bar id=■mybar■ att1=■...■ att2=■...■ att3=■...■ />
After this, an object with name mybar is available to the scripting
language.
The semantics of doStartTag() invocation is as before except that
additionally it should
insert the appropriate object for the ⌠mybar■ entry into the
pageContext.
The Tag Library Descriptor entry for this action needs to mention a
TagExtraInfo class
that will be used to determine the scripting variables that will be
created by the action; in this
case ⌠mybar■ (note that id must be a translation-time attribute).
------------------

Re: Scripting variable name

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Den Riabtchik wrote:
> 
> Hello!
> 
> According to JSP 1.1 spec when I try to declare a custom tag and specify
> an "id" attribute the JSP translator should create a scripting variable
> with appropriate name. But it seems to me that this feature is not
> supported in current version of Tomcat - all scripting variables have
> autogenerated names like "_jspx_th_" + unique id.
> Below there is an abstract from JSP 1.1 spec and it seems to me that it
> states that it is possible to specify the name of a scripting variable.

The Tag handler implementation class must be coupled with a TagExtraInfo
class that provides information to the JSP container about the variable
named by the id attribute for this to work. See the JSP spec for details.
It's implemented in Tomcat and works fine.

Hans

> Best regards,
> Den Riabtchik
> 
> -----------------
> 5.1.3.2 Call Functionality, No Body, Define Object
> In a simple variation of the previous example the action defines an
> object.
> <x:bar id=”mybar” att1=”...” att2=”...” att3=”...” />
> After this, an object with name mybar is available to the scripting
> language.
> The semantics of doStartTag() invocation is as before except that
> additionally it should
> insert the appropriate object for the “mybar” entry into the
> pageContext.
> The Tag Library Descriptor entry for this action needs to mention a
> TagExtraInfo class
> that will be used to determine the scripting variables that will be
> created by the action; in this
> case “mybar” (note that id must be a translation-time attribute).
> ------------------

-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com