Search code examples
templatesjsfdatagridejb

JSF and EJB #{...} not allowed in a template text body


I've added 2 managed beans: ProductController with 2 method:

ist<ProdusDTO> getList()
String update()

and ProductDTO, for entity Product.

index.jsp

<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<h:dataTable value="#{ProductController.getList()}" var="p">
        <h:column>
            <f:facet name="header">Description</f:facet> #{p.description}
        </h:column>
        <h:column>
            <f:facet name="header">Image</f:facet> #{p.image}
        </h:column>
    </h:dataTable>

    <h2>Adds</h2>
    <h:form>
        <h:panelGrid columns="3">
            Description: <h:inputText value="#{produsDTO.description}" size="100" required="true"></h:inputText>
            Image: <h:inputText value="#{productDTO.image}" size="100" required="true" label="Image"> </h:inputText>
        </h:panelGrid>
        <h:commandButton value="Submit" action="#{ProductController.update()}" />
    </h:form>

When I run the jsp file, I get this error:

PWC6228: #{...} not allowed in a template text body.

In the build path I've included jsf-api.jar and jsf-impl.jar (mojjara 1.2_15)

Why I can't specify for a dataTable component a method for value attribute?

Thanks.


Solution

  • Unified expression language deferred expressions are only allowed in custom tag attributes that support them (see JSP 2.1 for UEL support).

    This is a limitation of using JSPs and JSF. Deferred expressions must be used with a control tag (e.g. an outputText.)

    This issue was addressed with the Facelets view technology; consider upgrading if this is possible.