public class CompositeELResolver extends ELResolver {
+ private static final Class<?> SCOPED_ATTRIBUTE_EL_RESOLVER;
+ static {
+ Class<?> clazz = null;
+ try {
+ clazz =
+ Class.forName("javax.servlet.jsp.el.ScopedAttributeELResolver");
+ } catch (ClassNotFoundException e) {
+ // Ignore. This is expected if using the EL stand-alone
+ }
+ SCOPED_ATTRIBUTE_EL_RESOLVER = clazz;
+ }
+
private int size;
private ELResolver[] resolvers;
for (int i = 0; i < sz; i++) {
type = this.resolvers[i].getType(context, base, property);
if (context.isPropertyResolved()) {
- if (resolvers[i].getClass().getName().equals(
- "javax.servlet.jsp.el.ScopedAttributeELResolver")) {
- // Special case since this will always return Object.class
- // for type
+ if (SCOPED_ATTRIBUTE_EL_RESOLVER != null &&
+ SCOPED_ATTRIBUTE_EL_RESOLVER.isAssignableFrom(
+ resolvers[i].getClass())) {
+ // Special case since
+ // javax.servlet.jsp.el.ScopedAttributeELResolver will
+ // always return Object.class for type
Object value =
resolvers[i].getValue(context, base, property);
if (value != null) {