Own ELResolver and dataTable within a custom component

UI Components for JSF
Post Reply
Andi
Posts: 46
Joined: 10 May 2012, 18:55

24 May 2012, 01:51

Hello,

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);
       }
}
Further I create a custom component (myTable.xhtml).

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>
When I'm using the custom Component I get a PropertyNOtFoundException: /resources/comp/myTable.xhtml @26,52 value="#{cc.attrs.value}": The class 'com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap' does not have the property 'value'.

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>
Like I already told when I create this component everything works fine. I get no PropertyNotFoundException. Where is the problem? And how can I solve it.
Primefaces 3.4.1 - PE: 0.60 - Mojarra 2.1.7 - JBoss 7.1

Andi
Posts: 46
Joined: 10 May 2012, 18:55

24 May 2012, 15:28

I guess, I should write a issue report.
Primefaces 3.4.1 - PE: 0.60 - Mojarra 2.1.7 - JBoss 7.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 May 2012, 15:31

Not PF related.

Andi
Posts: 46
Joined: 10 May 2012, 18:55

24 May 2012, 16:17

Why not? When I`m using <h:dataTable> instead of <p:dataTable> everything works.
Primefaces 3.4.1 - PE: 0.60 - Mojarra 2.1.7 - JBoss 7.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 May 2012, 16:31

My bad, I misread.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests