https://bz.apache.org/bugzilla/show_bug.cgi?id=62453

--- Comment #7 from Konstantin Kolinko <knst.koli...@gmail.com> ---
I think that the feature of JSP Tag files reported in this BZ ticket is rather
confusing. In my opinion, if I have a tag file that declares 

<%@ attribute name="baz" %>

then evaluating "${baz}" should return the value of that attribute that I
declared. If the tag file was called without any value for the attribute,
return null, without falling back to outer scopes (requestScope.baz,
sessionScope.baz, applicationScope.baz).

This fallback behaviour is rather odd.


Specification text, JSP2.3MR.pdf - "JSP.8.3 Semantics of Tag Files" page
209/594:
[quote]
For each attribute declared and specified, a page-scoped variable must be
created
in the page scope of the JSP Context Wrapper, unless the attribute is a
deferred
value or a deferred method, in which case the VariableMapper obtained
from the ELContext in the current pageContext is used to map the deferred
expression to the attribute name. The name of the variable must be the same
as the declared attribute name. The value of the variable must be the value of
the attribute passed in during invocation. For each attribute declared as
optional
and not specified, no variable is created. [...]
[/quote]


If we deviate from the specification, and disable the fallback to outer scopes,
technically it can be done in Jasper, without changing the EL implementation:

When EL evaluates an identifier, it consults the VariableMapper first, before
looking into `ELResolver`s.

So if one registers such attribute in the VariableMapper as a ValueExpression
that evaluates to the constant value of null, the fallback to `ELResolver`s
will not happen.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to