6 Replies Latest reply on Jul 24, 2006 7:15 AM by viegas

    FacesContext

    viegas

      Im using the beans provided in the starters kit and Im getting a problem
      When the taskBean tries to get the "taskFormParameters" whith the command:

      "JsfHelper.getSessionAtribute("taskformParameters");
      

      the JsfHelper class tries to get the
      facesContext.getCurrentInstance
      and that returns null.

      Im not using beans.

      Can anyone help me please...thanks

        • 1. Re: FacesContext
          newbie007

          Did you modify web.xml of the webapp?

          Make sure you have following lines in the web.xml:

          <!-- MyFaces JSF -->

          <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


          <servlet-name>FacesServlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>

          <servlet-mapping>
          <servlet-name>FacesServlet</servlet-name>
          <url-pattern>/faces/*</url-pattern>
          </servlet-mapping>

          Another question is: In the beginning you said "Im using beans" and at the end you said "I am not using beans". What does that mean?

          Are you using default webapp or you changed the implementation?

          Thanks.

          • 2. Re: FacesContext
            viegas

            Im am using the beans source, but I changed the webapp, Im using standart jsp. I have the classes included in the classpath and I use then in the servlet and java code

            thanks

            • 3. Re: FacesContext
              viegas

              Im am using the beans source, but I changed the webapp, Im using standart jsp. I have the classes included in the classpath and I use then in the servlet and java code

              thanks

              • 4. Re: FacesContext
                newbie007

                If you changed the webapp, you still using JSF?

                If you are using your own servlet then why not prepare the form parameters list on your own and set it to the request or session (whatever feasiable)

                Preparing form parameter list is straight forward:

                List taskFormParameters = new ArrayList();
                 TaskController taskController = taskInstance.getTask().getTaskController();
                 if (taskController!=null) {
                 List variableAccesses = taskController.getVariableAccesses();
                 Iterator iter = variableAccesses.iterator();
                 while (iter.hasNext()) {
                 VariableAccess variableAccess = (VariableAccess) iter.next();
                 String mappedName = variableAccess.getMappedName();
                 Objec! value = taskInstance.getVariable(mappedName);
                 TaskFormParameter tfp = new TaskFormParameter(variableAccess, value);
                 taskFormParameters.add(tfp);
                 }


                Thanks.

                • 5. Re: FacesContext
                  viegas

                  Im not using JSF,
                  I implemented the code you described asn it worked , but I tried to do the "same" to the set method and it failed(something i did wrong
                  my code was:

                  TaskController taskController = taskInstance.getTask().getTaskController();
                  if (taskController!=null) {
                  taskControler.submitParameters((TaskInstance) taskParameters);
                  }
                  
                  is this kind of code/API described with examples?
                  
                  thanks


                  • 6. Re: FacesContext
                    viegas

                    Ignore my last post, Ive finally understood what you said, this part is working fine now.

                    Thanks for your sugestion