ICEfaces
  1. ICEfaces
  2. ICE-7351

@form causes an exception when used with dataTable

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 2.1 BETA
    • Assignee Priority:
      P1

      Description

      An exception is thrown when the page is loaded, if a data table use @form in
      onRowSelectUpdate and/or onRowUnselectUpdate attributes:
        <ace:dataTable id="dataTable"
                                               var="record"
                                               value="#{myBean.listWithRecords}"
                                               rowIndexVar="rowNo"
                                               rowStyleClass=" #{myBean.applyCSS(record.selected)} "
                                               selectionMode="multiple"
                                               style="font-size: 14px; text-align: center;"
                                               onRowSelectUpdate="@form"
                                               onRowUnselectUpdate="@form">

      Stack Trace:
      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Component form needs to be enclosed in a form
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:422)
      org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
      root cause

      javax.faces.FacesException: Component form needs to be enclosed in a form
      org.icefaces.ace.util.ComponentUtils.formatKeywords(ComponentUtils.java:214)
      org.icefaces.ace.util.ComponentUtils.findClientIds(ComponentUtils.java:227)
      org.icefaces.ace.component.datatable.DataTableRenderer.encodeSelectionConfig(DataTableRenderer.java:1192)
      org.icefaces.ace.component.datatable.DataTableRenderer.encodeScript(DataTableRenderer.java:459)
      org.icefaces.ace.component.datatable.DataTableRenderer.encodeEntierty(DataTableRenderer.java:529)
      org.icefaces.ace.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:440)
      javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
      javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
      org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:54)
      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
      com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
      com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
      org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

      If @form is replaced with @this the page loads normally.

        Activity

        Hide
        Ken Fyten added a comment -

        Mircea, please analyze what's going on in this scenario.

        Show
        Ken Fyten added a comment - Mircea, please analyze what's going on in this scenario.
        Hide
        Mircea Toma added a comment -

        The issue occurs only when the form component is a direct parent of the data table component.

        Show
        Mircea Toma added a comment - The issue occurs only when the form component is a direct parent of the data table component.
        Hide
        Mircea Toma added a comment - - edited

        Modified ComponentUtils.findParentForm method to start its search with the passed in component, instead of its parent. This is useful in cases when the component using ComponentUtils.findParentForm is already passing in its parent. In case the parent itself is a form the method will still be able to find the form as expected by the component.

        Show
        Mircea Toma added a comment - - edited Modified ComponentUtils.findParentForm method to start its search with the passed in component, instead of its parent. This is useful in cases when the component using ComponentUtils.findParentForm is already passing in its parent. In case the parent itself is a form the method will still be able to find the form as expected by the component.
        Hide
        Mircea Toma added a comment -

        Modified DataTableRenderer to pass in the table component itself when trying to translate the submit keywords to avoid having the search for the enclosing form fail when the direct parent is the form component.

        This modification is a redundant after the fix described in previous comment but it's still valuable as good practice when using ComponentUtils.findClientIds method.

        Show
        Mircea Toma added a comment - Modified DataTableRenderer to pass in the table component itself when trying to translate the submit keywords to avoid having the search for the enclosing form fail when the direct parent is the form component. This modification is a redundant after the fix described in previous comment but it's still valuable as good practice when using ComponentUtils.findClientIds method.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Evgheni Sadovoi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: