Hi all!!!

In the org.apache.commons.el.ArraySuffix class, inside the "evaluate"
method, it could be possible to add the following lines as the ending else.
This way, DynaBeans could be supported, giving the possibility of accesing
DynaBean properties like if we were accesing an array index.

--------------- Begin Code fragment ----------------
      else {
           try {
               Object val = null;
               Method m = pValue.getClass().getMethod("get", new Class[] {
String.class });
               val = m.invoke(pValue, new Object[] { indexVal + "" });
               return val;
           } catch (Exception ex) {
               if (pLogger.isLoggingError()) {
                   pLogger.logError(Constants.CANT_FIND_INDEX, indexVal,
                           .getName(), getOperatorSymbol());
               return null;
--------------------- End Code fragment ---------------------------------

In the EL of your JSP's you could access a DynaBean property like this
(assume b is an instance of a DynaBean implementation, that contains an id
which is a Integer object, and a name which is a wrapper for two strings:
lastName and firstName):

Id: <c:out value="${b[id]}"/>
Name: <c:out value="${b[name].firstName}"/> <c:out

I've tried it and still don't have any troubles doing this.

Hope it is useful.

Camilo A. Gonzalez
Ing. de Sistemas
Lider Grupo Desarrollo
Dirección Nacional de Admisiones
Univ. Nacional de Colombia
Tel: 300 657 96 96
Tel: 57 1 316 5000 Ext: 18519

Reply via email to