Details
Description
bug report like bug tapestry-408
in my table component define
columns="id.bigClientId:title1:[0].id.bigClientId,
contractDate:mydate:@com.csair.keyacc.Visit@formatter.format([0].contractDate)"
it can't access static field !!
weblogic 8.1.3+windows 2000+eclipse
/* when weblogic classpath include ognl.jar
- mywebapp
- +web-inf
- +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
*/
//org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
public Object getColumnValue(ITableColumn objColumn, Object objRow)
{
// If no expression is given, then this is dummy column. Return something.
if (m_strExpression == null || m_strExpression.equals(""))
return "";
if (m_objParsedExpression == null)
{
synchronized (this)
}
try
{ Object objValue = Ognl.getValue(m_objParsedExpression, objRow); return objValue; }
catch (OgnlException e)
{ LOG.error( "Cannot use column expression '" + m_strExpression + "' in row", e); return ""; }
}
patch:
// org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
/**
* @see org.apache.tapestry.contrib.table.model.simple.ITableColumnEvaluator#getColumnValue(ITableColumn, Object)
*/
public Object getColumnValue(ITableColumn objColumn, Object objRow)
{
// If no expression is given, then this is dummy column. Return something.
if (m_strExpression == null || m_strExpression.equals(""))
return "";
if (m_objParsedExpression == null)
{
synchronized (this)
{ if (m_objParsedExpression == null) m_objParsedExpression = OgnlUtils.getParsedExpression(m_strExpression); }
}
try
{
ClassResolver resolver= new ClassResolver(){
public Class classForName(String className, Map context) throws ClassNotFoundException
{ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); return Class.forName(className, true, contextClassLoader); } };
Map context = Ognl.createDefaultContext(objRow, resolver);
Object objValue= Ognl.getValue(m_objParsedExpression, context, objRow);
//Object objValue = Ognl.getValue(m_objParsedExpression, objRow);
return objValue;
}
catch (OgnlException e)
catch(RuntimeException ex)
{ System.out.println("throw Exception OgnlTableColumnEvaluator!!"); ex.printStackTrace(); throw ex; }catch(Exception ex)
{ ex.printStackTrace(); throw new RuntimeException(ex); }}
weblogic 8.1.3+windows 2000+eclipse
/* when weblogic classpath include ognl.jar;tapestry-3.x.x.jar;tapestry-contrib-patch.jar
- mywebapp
- +web-inf
- +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
*/
and run Ok!