Hello!

I’ve recently upgraded from Tomcat 8.0.23 to 8.0.41 and noticed that the EL
context that is available to JSPs in my application is no longer available
in tagfiles used inside those JSPs (which was the case in 8.0.23).

We have a servlet listener declared in our web.xml which reacts to
contextInitialized events by adding an ElContextListener to the current
JSPApplicationContext (accessed
via JspFactory.getDefaultFactory().getJspApplicationContext()).  This
ELContextListener populates the current ElContext (acquired via
the ELContextEvent passed to the contextCreated method) with a number of
static tools that we use in our EL expressions inside JSPs and tagfiles.

The contextCreated() calls to our ElContextListener appear to be the same
between 8.0.23 and 8.0.41 when testing with the same JSP; but inside the
tagfiles themselves, the classes that we are adding to the context are not
available.  For example, we are adding an ArrayUtils class which we were
previously accessing via an expression like
${ArrayUtils.contains(pageScope.someArray, pageScope.someValue}.  This
expression works inside a JSP, but not in a tagfile.

I looked through the changelog entries between 8.0.23 and 8.0.41 and came
across a couple items which may be related to this issue:

- 58178: Expressions in a tag file should use the tag file's PageContext
rather than that of the containing page.
- Following on from the fix for 58178, expressions in a tag file should use
the tag file's imports rather than those of the containing page.

Is there some way to preserve the behavior we were relying on before?  It
seems like either more contextCreated events should be firing (perhaps once
per tagfile invocation?) to make up for the changes listed above or that
the ElContext being used should be passed from the JSP “context” into the
tagfiles.  Just reading above change entries, though, the latter solution
seems like it’d require reverting those exact changes which doesn’t seem
ideal.

Thanks for the help!

--
Mike Strauch
w. www.hannonhill.com
e mike.stra...@hannonhill.com

Reply via email to