Created attachment 25055 [details] Adds 2 new classes (ELParameters and CoerceToZeroConfigurer) in a new package (org.apache.el.parser.parameters) while modifying the AstValue class, composing a solution proposal to this issue. The parameter "org.apache.el.parser.COERCE_TO_ZERO" can only be used while starting up Tomcat or any other application that uses the Jasper Expression Language implementation. I think that one should be able to set such parameter on runtime, specially while an application is being loaded. The attached patch implements the requested feature.
Please, notice that the patch was made against the trunk, revision 915902.
ELParameters#coerceToZero in the proposed patch is a static field, and thus will be shared among web applications. Thus this implementation will work no better than the old one. No good.
Well, that's absolutely true... and somewhat embarassing too. It is really important that each application is able to set such parameter for itself. Right now I can't figure out a way of doing that. I'm thinking about setting attributes on the ServletContext or using ThreadLocal variables with help of a ServletContextListener or a ServletRequestListener, but I'm still having trouble figuring out how to retrieve those values. Well, I guess I'll think about it and try something else later.
Created attachment 25067 [details] Solves this issue and fixes the problem pointed by Konstantin. This patch implements the mentioned feature and allows different web applications to set particular values of the parameter for themselves.
The private boolean field coerceToZero could - and should - be made final.
Created attachment 25069 [details] Making the coerceToZero field final, as proposed. I agree with Sebb.
Hi, since I posted the last version of the patch I've not seen mutch discussion about it. I'd really like to have this feature implemented on Tomcat's EL. Will you implement it? Is there something avoiding you from doing it that I could help?
-1 to the patch as written since it creates a dependency on the Servlet API. The EL implementation should stand on its own.
Hum... This is an important point. Let me think a bit about this and see if I can make some new proposal that removes such dependency that's worth the effort.
I'd like to close this issue. I needed it to run Mojarra 1.2 but on version 2.1 they found an workaround to the problems I had. Also I wasn't able to solve the problem exposed by Mark Thomas. Thank you for your attention.