10 Replies Latest reply on Oct 26, 2017 8:41 AM by bmkrish

    How to decide what page to redirect with JBPM

    uesker

      Hi!
      In my app, I have a taskInstanceList and a link for execute each task avaliable. However, before start a task, I have to discover to what xhtml page I have to redirect. So, i used the strategy described bellow



      <rich:dataTable value="#{taskInstanceList}" var="_task" rendered="#{taskInstanceList != null}">
                              <rich:column>
                                      <f:facet name="header">#{messages['task.name']}</f:facet>
                                      #{_task.name}
                              </rich:column>
                              <rich:column>
                                      <f:facet name="header">#{messages['task.description']}</f:facet>
                                      #{_task.description}
                              </rich:column>
                              <rich:column>
                                      <f:facet name="header">#{messages['task.date']}</f:facet>
                                      <h:outputText value="#{_task.create}">
                                              <f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
                                      </h:outputText>
                              </rich:column>
                              <rich:column>
                                      <s:link action="#{pageDecisionHandler.redirectToPage(_task.id)}" taskInstance="#{_task}"                       value="#{messages['task.execute']}"/>
                              </rich:column>
                      </rich:dataTable>



      And In the pageDecisionHandler component I have



      @Name("pageDecisionHandler")
      public class PageDecisionHandler {
              
              @In
              private JbpmContext jbpmContext;
              
              public String redirectToPage(int id) {
                      TaskInstance taskInstance = jbpmContext.getTaskInstance(id);
                      if (taskInstance != null) {
                              jbpmContext.loadTaskInstance(id);
                              String taskName = taskInstance.getName();
                              if (taskName.equalsIgnoreCase("context")) {
                                      return "/fillContext.xhtml";
                              } else if (taskName.equalsIgnoreCase("objectivies")) {
                                      return "/fillObjectivies.xhtml";
                              }
                      }
                      
                      return null;
              }
      }



      Finally, on fillContext.page.xml I have a tag start-task


      unfortunately, with this code, I cannot have access to taskInstance Id and I can´t redirect to any page.
      How can I Solve this?


      Cheers


        • 1. Re: How to decide what page to redirect with JBPM
          uesker

          I forgot to mention that value of parameter Id is 0

          • 2. Re: How to decide what page to redirect with JBPM
            cbensemann

            I have used a similar approach when I need to work out which page to redirect to. I have found you don't need to pass in the id and look it up in the jbpmContext though.


            You should be able to use an s:link as you have done:


            <s:link action="#{pageDecisionHandler.redirectToPage()}" taskInstance="#{_task}" value="#{messages['task.execute']}"/>
            



            Note we are no longer passing in the id into the redirectToPage method.


            In your handler bean you would have something like:


            @Name("pageDecisionHandler")
            public class PageDecisionHandler {
                    
                    @In(required = false)
                    private TaskInstance taskInstance;
                    
                    @BeginTask
                    public String redirectToPage() {
                            if (taskInstance != null) {
                                    String taskName = taskInstance.getName();
                                    if (taskName.equalsIgnoreCase("context")) {
                                            return "/fillContext.xhtml";
                                    } else if (taskName.equalsIgnoreCase("objectivies")) {
                                            return "/fillObjectivies.xhtml";
                                    }
                            }
                            
                            return null;
                    }
            }
            

            • 3. Re: How to decide what page to redirect with JBPM
              uesker

              Hi,


              I´m appreciate your help!
              I tried the example mentioned before, but now i faced with this exception, even with the use of @Begin


              Here is the code



              @Name("pageDecisionHandler")
              @Scope(ScopeType.CONVERSATION)
              public class PageDecisionHandler {
                   
                   @In
                   private TaskInstance taskInstance;
                   
                   @Begin(join=true)
                   @BeginTask
                   public String redirectToPage() {
                        
                        if (taskInstance != null) {
                             String taskName = taskInstance.getName();
                             if (taskName.equalsIgnoreCase("context")) {
                                  return "/fillContext.xhtml";
                             } else if (taskName.equalsIgnoreCase("objectivies")) {
                                  return "/fillObjectivies.xhtml";
                             }
                        }
                        
                        return null;
                   }
              }



              And the exception




              Exception during request processing:
              Caused by javax.el.ELException with message: "java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(join=true) on method: redirectToPage"
              
              org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
              org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
              org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
              org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
              org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
              org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
              org.jboss.seam.navigation.Pages.callAction(Pages.java:703)
              org.jboss.seam.navigation.Pages.preRender(Pages.java:331)
              org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
              org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
              org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
              org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
              com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
              com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
              com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
              org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
              org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              java.lang.Thread.run(Unknown Source)
              
              Caused by java.lang.IllegalStateException with message: "begin method invoked from a long-running conversation, try using @Begin(join=true) on method: redirectToPage" 



              Thanks




              • 4. Re: How to decide what page to redirect with JBPM
                cbensemann

                Generally speaking you should be able to do as the error message has said. That is to add join=true. Looking at my code that is in fact what I have.

                • 5. Re: How to decide what page to redirect with JBPM
                  uesker

                  Craig Bensemann wrote on Aug 31, 2010 18:26:


                  Generally speaking you should be able to do as the error message has said. That is to add join=true. Looking at my code that is in fact what I have.


                  I´m already tried this. I added the begin-conversation tag on page.xml



                  <page view-id="/listActivities.xhtml">
                       <begin-conversation join="true"/>
                   </page>



                  and modified s:link to this


                  <s:link action="#{pageDecisionHandler.redirectToPage} taskInstance="#{_task}" value="#{messages['task.execute']}" propagation="join"/>



                  So, when I click on this link I´m redirect to Seam Debug Page. I don´t know if this is important but there is no bussiness process context described on Seam debug page.


                  Thanks for the help!

                  • 6. Re: How to decide what page to redirect with JBPM
                    cbensemann

                    Hi,


                    Sorry I didn't ready your previous post properly. I see now you already had @Begin(join=true). What you have looks very similar to what I am doing.


                    Instead of s:link I have


                    <a4j:commandButton action="#{manageTasksController.action()}"
                         value="#{messages[manageTasksController.actionButton(task)]}"
                         onclick="this.disabled=true; document.body.style.cursor='wait'"
                         oncomplete="this.disabled=false; document.body.style.cursor='auto'" styleClass="long_button">
                         <s:taskId value="#{task.id}" />
                         <s:conversationPropagation type="none" />
                    </a4j:commandButton>
                    



                    I know s:links also work as I was using links previously. Looking at my code I see that I have a conversationPropagation type=none. I cant remember why I put that in there so am not sure if its important.


                    My manage tasks page (which is equivalent to your listActivities page) I don't use pages.xml to define the begin conversation. Again not sure if this is important but its a difference between our implementations so I thought I would mention it.


                    pages.xml


                        <page view-id="/pages/user/manageTasks.xhtml" login-required="true" scheme="https">
                            <navigation from-action="#{pooledTask.assignToCurrentActor}">
                                <redirect view-id="/pages/user/manageTasks.xhtml" />
                            </navigation>
                        </page>
                    



                    in my manageTasksController bean my action method looks like:


                        @BeginTask(flushMode = FlushModeType.MANUAL)
                        @Begin(join = true)
                        public String action() {
                            final String taskType = taskInstance.getName();
                    
                            if (Injury.class.getName().equals(className)) {
                                return injuryNavigation(taskType);
                            }
                            else if (Hazard.class.getName().equals(className)) {
                                return hazardNavigation(taskType);
                            }
                    
                            return null;
                        }
                    



                    The flushmode shouldn't be important here. Apart from that I am just using the beginTask annotation and begin annotation the same as you are.


                    I'm not really sure why yours is not working but hopefully something in the code I have just posted will help you solve your problem


                    Craig

                    • 7. Re: How to decide what page to redirect with JBPM
                      uesker

                      I made some modifications and now I´m facing a new exception... :-(


                      Here is the complete listActivities page



                      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                          xmlns:s="http://jboss.com/products/seam/taglib"
                          xmlns:ui="http://java.sun.com/jsf/facelets"
                          xmlns:f="http://java.sun.com/jsf/core"
                          xmlns:h="http://java.sun.com/jsf/html"
                          xmlns:rich="http://richfaces.org/rich"
                          xmlns:a4j="http://richfaces.org/a4j"
                          template="layout/template.xhtml">
                      
                          <ui:define name="body">
                               <h:form>
                               <a4j:outputPanel id="pooledTasks">
                                    <h:outputText value="#{messages['listactivities.pooledtasks.message']}"/>
                                    <h:outputText value="#{messages['srprocess.notasks.messages']}" rendered="#{empty pooledTaskInstanceList}"/>
                                    <rich:dataTable value="#{pooledTaskInstanceList}" var="task" rendered="#{not empty pooledTaskInstanceList}">
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.name']}</f:facet>
                                              #{task.name}
                                         </rich:column>
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.description']}</f:facet>
                                              #{task.description}
                                         </rich:column>
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.date']}</f:facet>
                                              <h:outputText value="#{task.create}">
                                                   <f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
                                              </h:outputText>
                                         </rich:column>
                                         <rich:column>
                                              <s:link action="#{pooledTask.assignToCurrentActor}" value="#{messages['task.assign']}" taskInstance="#{task}" propagation="none">
                                                   <a4j:support event="onclick" ajaxSingle="true" reRender="pooledTasks, myTasks"/>
                                              </s:link>
                                         </rich:column>
                                    </rich:dataTable>
                                    
                                    <rich:spacer height="15px"/>
                                    <rich:separator height="10px"/>
                                    <rich:spacer height="15px"/>
                               </a4j:outputPanel>
                               
                               <a4j:outputPanel id="myTasks">
                                    <h:outputText value="#{messages['listactivities.mytasks.message']}"/>
                                    <h:outputText value="#{messages['srprocess.notasks.messages']}" rendered="#{empty taskInstanceList}"/>
                                    <rich:dataTable value="#{taskInstanceList}" var="_task" rendered="#{not empty taskInstanceList}">
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.name']}</f:facet>
                                              #{_task.name}
                                         </rich:column>
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.description']}</f:facet>
                                              #{_task.description}
                                         </rich:column>
                                         <rich:column>
                                              <f:facet name="header">#{messages['task.date']}</f:facet>
                                              <h:outputText value="#{_task.create}">
                                                   <f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
                                              </h:outputText>
                                         </rich:column>
                                         <rich:column>
                                              <s:link action="#{pageDecisionHandler.redirectToPage}" 
                                                      taskInstance="#{_task}" 
                                                      value="#{messages['task.execute']}" />
                      
                                         </rich:column>
                                    </rich:dataTable>
                               </a4j:outputPanel>
                                </h:form>         
                          </ui:define>
                      </ui:composition>
                      



                      I removed the following code from pages.xml



                      <page view-id="/listActivities.xhtml">
                           <begin-conversation join="true"/>
                       </page>



                      and now I can debug the redirectToPage() method. However, after execution of method, this exception it´s throw on seam debug page.



                      Exception during request processing:
                      Caused by java.lang.NullPointerException with message: ""
                      
                      org.jboss.seam.bpm.BusinessProcess.startTask(BusinessProcess.java:178)
                      org.jboss.seam.navigation.TaskControl.beginOrEndTask(TaskControl.java:36)
                      org.jboss.seam.navigation.Page.preRender(Page.java:290)
                      org.jboss.seam.navigation.Pages.preRender(Pages.java:351)
                      org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
                      org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
                      org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
                      org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
                      com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
                      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
                      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                      javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
                      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
                      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
                      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                      org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                      org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                      java.lang.Thread.run(Unknown Source)
                      
                      



                      Here is the code on pages.xml related to fillContext.xhtml



                      <page view-id="/fillContext.xhtml">
                          <begin-conversation join="true"/>
                          <start-task/>
                       </page>



                      The fillContext.xhtml is quite simple...



                      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                          xmlns:s="http://jboss.com/products/seam/taglib"
                          xmlns:ui="http://java.sun.com/jsf/facelets"
                          xmlns:f="http://java.sun.com/jsf/core"
                          xmlns:h="http://java.sun.com/jsf/html"
                          xmlns:rich="http://richfaces.org/rich"
                          template="layout/template.xhtml">
                      
                      <ui:define name="body">
                      
                          <h:form id="fillContextForm">
                      
                              <rich:panel>
                                   <div align="center">
                                  <f:facet name="header">#{messages['srprocess.fillcontext.page.title']}</f:facet>
                                     <h:outputText value="#{messages['srprocess.fillcontext.page.description']}"/><br/>
                                  <rich:editor value="#{srprotocol.context}" width="640" height="480"/>
                                  <div style="clear:both"/>
                                  </div>
                              </rich:panel>
                      
                              <div class="actionButtons">
                                  <h:commandButton value="#{messages['button.next']}" action="#{contextAction.endFillContext}">
                                       <f:param name="taskId" value="#{taskInstance.id}"/>
                                       <s:conversationPropagation type="join"/>
                                  </h:commandButton>
                                  <s:button propagation="end"
                                                     id="cancel"
                                                  value="#{messages['button.cancel']}"
                                                   view="/listActivities.xhtml"/>
                              </div>
                      
                          </h:form>
                      
                      </ui:define>
                      
                      </ui:composition>
                      



                      Finnaly, the contextAction component



                      @Name("contextAction")
                      @Scope(ScopeType.CONVERSATION)
                      public class ContextAction {
                           
                           @In @Out(scope=ScopeType.BUSINESS_PROCESS, required=false)
                           protected SRProtocol srprotocol;
                           
                           @In
                           private JbpmContext jbpmContext;
                           
                           @In
                           private Actor actor;
                           
                           @In
                           private StatusMessages statusMessages;
                           
                           public SRProtocol getSrprotocol() {
                                return srprotocol;
                           }
                      
                           public void setSrprotocol(SRProtocol srprotocol) {
                                this.srprotocol = srprotocol;
                           }
                      
                           @EndTask(transition="context done")
                           public String endFillContext() {
                                statusMessages.addFromResourceBundle("srprocess.fillcontext.page.sucess");
                                return "/fillObjectivies.xhtml";
                           }
                      }



                      The ideia here is to continue to execute the process and redirect to another page so the user can fill the information related with next task


                      Please, I´m sorry for any inconvenience but there is no much people on my job to help me with this issue


                      Thanks a lot!











                      • 8. Re: How to decide what page to redirect with JBPM
                        uesker

                        Hi!
                        I have made a modification on pages.xml and now I´m redirect to fillContext.xhtml.



                        <page view-id="/fillContext.xhtml">
                            <begin-conversation join="true"/>
                            <start-task taskId="#{taskInstance.id}"/>
                         </page>



                        But when I click on next button, the problem persists (same expection Exception during request processing:
                        Caused by java.lang.NullPointerException with message: ).
                        So I did the same to fillObjectivies on page.xml but did not work. Probably the problem is on endFillContext method.
                        So, how can I propage taskInstance among the xhtml pages?


                        Cheers

                        • 9. Re: How to decide what page to redirect with JBPM
                          cbensemann

                          Hi,


                          I'm sorry I'm not sure what the problem is. The fact that you are getting that null pointer suggests that you are not currently in a conversation or that there is no business context active to get the TaskInstance from.


                          I hope you (or someone else on this forum) is able to sort this out. Feel free to keep posting updates to this thread and I'll help if I can think of anything but right now I'm stumped to see whats wrong.


                          Craig

                          • 10. Re: How to decide what page to redirect with JBPM
                            bmkrish

                            Dear Craig,

                            this is bala from HCL Tech .I am new to JBPM  and I trying to do redirect to from  the process .I noticed that you have done already .Could you please share me the code which you have done.

                            Thanks,

                            Bala