Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-1587

Use JSF parameterMap instead of <viewParam> to avoid problems with JSF validation

      JSF-based taskforms are used in combination with the org.camunda.bpm.engine.cdi.jsf.TaskForm class.

      This class can be invoked using

      <f:metadata>
      <f:viewParam id="taskId" name="taskId" />
      <f:viewParam id="callbackUrl" name="callbackUrl" />
      <f:event type="preRenderView" listener="#

      {camunda.taskForm.startTask(taskId, callbackUrl)}" />
      </f:metadata>

      Bug:
      ===
      Invoking a method using Expression language with null params fails. Null params occur if one of the vew params in

      <f:viewParam id="taskId" name="taskId" />
      <f:viewParam id="callbackUrl" name="callbackUrl" />
      <f:event type="preRenderView" listener="#{camunda.taskForm.startTask(taskId, callbackUrl)}

      " />

      is null.

      This is true for the following methods:

      • `startTask(taskId, callbackUrl)`
      • `startProcessInstanceByIdForm(processDefinitionId, callbackUrl)`
      • `startProcessInstanceByKeyForm(processDefinitionKey, callbackUrl)`

      Proposed fix:
      =========

      AT:
      Add a methods with signature

      • startTaskForm()
      • startProcessInstanceByIdForm()
      • startProcessInstanceByKeyForm()
        Ie. taking no parameter.

      The methods should read the parameters from `FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();`

      Usage in JSF form:

      <f:metadata>
      <f:event type="preRenderView" listener="#

      {camunda.taskForm.startTaskForm()}

      " />
      </f:metadata>

      Important: update documentation and examples with new method signature.

      See this commit for an example: https://github.com/camunda/camunda-bpm-examples/commit/042d9a093c6009f8eeca178308f4bbd8c462e8ef


      see https://groups.google.com/forum/#!msg/camunda-bpm-users/Haqwm-XJk8k/NZ9t5ji1o0QJ
      and https://github.com/camunda/camunda-bpm-examples/blob/master/invoice-en/src/main/java/org/camunda/bpm/demo/invoice/InvoiceTaskForm.java

        This is the controller panel for Smart Panels app

            [CAM-1587] Use JSF parameterMap instead of <viewParam> to avoid problems with JSF validation

            In which sense is this a bug. What should be changed?

            Daniel Meyer added a comment - In which sense is this a bug. What should be changed?

            The viewParam does not work if you use JSF validation (as somehow the viewParams are null in the next page rendering). But changing it to retrieve the parameters via the way shown in the example is save and works always here.

            Best ask Kristin - she knows the bug pretty well

            Bernd Ruecker added a comment - The viewParam does not work if you use JSF validation (as somehow the viewParams are null in the next page rendering). But changing it to retrieve the parameters via the way shown in the example is save and works always here. Best ask Kristin - she knows the bug pretty well

            Talked to kristin and provided Description

            Daniel Meyer added a comment - Talked to kristin and provided Description

            Bernd Ruecker added a comment - I think http://docs.camunda.org/latest/real-life/how-to/#user-interface-jsf-task-forms should be adjusted for 7.1 accordingly

            Daniel Meyer added a comment -

            The quickstart (https://github.com/camunda/camunda-quickstarts/tree/master/usertask/task-form-external-jsf) should be tested on

            • JBoss
            • Glassfish
            • Websphere

            Daniel Meyer added a comment - The quickstart ( https://github.com/camunda/camunda-quickstarts/tree/master/usertask/task-form-external-jsf ) should be tested on JBoss Glassfish Websphere

            not working on websphere.
            Error msg:
            /submitLoanRequest.xhtml at line 7 and column 15 <f:metadata> Parent UIComponent j_id295035565_1195e2b7 should be instance of UIViewRoot

            Caused by:
            javax.faces.view.facelets.TagException - /submitLoanRequest.xhtml at line 7 and column 15 <f:metadata> Parent UIComponent j_id295035565_1195e2b7 should be instance of UIViewRoot

            Michael Schoettes added a comment - not working on websphere. Error msg: /submitLoanRequest.xhtml at line 7 and column 15 <f:metadata> Parent UIComponent j_id295035565_1195e2b7 should be instance of UIViewRoot Caused by: javax.faces.view.facelets.TagException - /submitLoanRequest.xhtml at line 7 and column 15 <f:metadata> Parent UIComponent j_id295035565_1195e2b7 should be instance of UIViewRoot

              michael.schoettes Michael Schoettes
              ruecker Bernd Ruecker
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: