Search code examples
jsficefaces

NullPointerException when editing ICEFaces ace:datatable using ace:cellEditor


I was using code similar to this stripped down example:

<h:form id="form">
   <ace:dataTable id="carTable"
                            value="#{dataTableRowEditing.cars}"
                            var="car">          
        <ace:column id="name" headerText="Name">
            <ace:cellEditor>
                <f:facet name="output">
                    <h:outputText id="nameCell" value="#{car.name}"/>
                </f:facet>
                <f:facet name="input">
                    <h:inputText id="nameInput" value="#{car.name}"/>
                </f:facet>
            </ace:cellEditor>
       </ace:column>
       <ace:column id="options" headerText="Options">
           <ace:rowEditor id="editor"/>
       </ace:column>
    </ace:dataTable>
</h:form>

I was then getting the following error upon loading the JSF page:

com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException SEVERE: Error Rendering View[/index.xhtml]

When searching for this error, one solution I found was to make sure I had the two <f:facet> elements for input and output, but I already had these elements.


Solution

  • The solution that worked for me was double checking my xmlns attributes in my <html> tag. I had the following:

    <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/composite"
        >
    

    However, xmlns:f="http://java.sun.com/jsf/composite" was incorrect. It should instead be xmlns:f="http://java.sun.com/jsf/core. The corrected <html> tag is shown below:

    <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
        >
    

    After fixing this, the error was resolved and editing functionality worked correctly.