1 Reply Latest reply on Apr 3, 2006 4:32 AM by hannes

    Add HttpPost-Vars to Context Vars

    ken1

      Hi,

      I tried to add the POST-Vars of a servlet-request to jbpm-context-vars, but I cant access them after that. The code is:

      protected void doPost(HttpServletRequest req, HttpServletResponse response) ..{
      ..
       ProcessInstance processInstance =
       new ProcessInstance(processDefinition);
       processInstance.getContextInstance().addVariables(req.getParameterMap());
       System.out.print(processInstance.getContextInstance().getVariables());
       System.out.print(req.getParameterMap());
       System.out.print(req.getParameter("product"));
       System.out.print(processInstance.getContextInstance().getVariable("product");
      ..
      


      The first and the 2nd output are exactly the same, 3rd and 4th are different - 3rd is the correct string, 4th an Object.
      I'm out of ideas :(

      regards, ken



        • 1. Re: Add HttpPost-Vars to Context Vars
          hannes

          Try to name your object you are putting in the context.

          processInstance.getContextInstance().createVariable("id", Long.valueOf(555));

          the you can get the exact same Object:
          Object id = executionContext.getContextInstance().getVariable(
           "id");

          (3.0.2)