On 02/03/17 20:18, Mike Strauch wrote: > 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.
I think you have correctly identified the commits responsible for the change of behaviour you see. Of the two solutions you propose, I agree the latter solution is not viable. The former solution looks possible and - based on a fairly quick review of the specs - should be happening anyway. What would be very helpful would be if you could put together the simplest possible web application that demonstrates this problem and attach it a new Bugzilla issue. I have some initial ideas for how to fix this but it would be helpful to have a test case to confirm any proposed fix. Thanks, Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org