I create a own ELResolver to resolve custom EL-Statements (e. g. #{person[adress+city] gets the nested property city). Following the code:
Code: Select all
public class MyResolver extends BeanELResolver {
@Override
public Object getValue(ELContext context, Object base, Object property) {
...
String propertyString = property.toString();
if(propertyString.contains("+"))
{
Object value = base;
for(String part : property.toString().split("\\+"))
{
value = super.getValue(context, value, part);
}
return value;
}
return super.getValue(context, base, property);
}
}
Code: Select all
<cc:implementation>
<p:dataTable var="data" value="#{cc.attrs.value}">
<c:forEach items="#{cc.attrs.columns}" var="columns" varStatus="index">
<p:column>
<f:facet name="header">
<h:outputText value="#{columns}"/>
</f:facet>
<h:outputText value="#{data[columns]}" />
</p:column>
</c:forEach>
</p:dataTable>
</cc:implementation>
But if I'm using the standard jsf html tag library to create the dataTable everything works fine. Following myTable.xhtml with jsf html tag.
Code: Select all
<cc:implementation>
<h:dataTable var="data" value="#{cc.attrs.value}">
<c:forEach items="#{cc.attrs.columns}" var="columns" varStatus="index">
<h:column>
<f:facet name="header">
<h:outputText value="#{columns}"/>
</f:facet>
<h:outputText value="#{data[columns]}" />
</h:column>
</c:forEach>
</h:dataTable>
</cc:implementation>