6 Replies Latest reply on Mar 10, 2009 9:38 AM by ilya_shaikovsky

    Wizard problem

      I create a wizard with modelPanel. In step1, I use a combbox, so that the user can select the next step.

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:dim="http://dimetis.de/jsf">
      
       <rich:panel styleClass="backgroundNet" style="height:275px">
       <a4j:outputPanel id="createTaskType">
       <h:panelGrid style="margin-left:60px; margin-top:10px;">
       <h:selectOneMenu style="width : 360px;" ajaxSingle="true"
       value="#{createTaskDialogBean.taskType}">
       <f:selectItems value="#{createTaskDialogBean.taskTypes}" />
       <a4j:support event="onchange"/>
       </h:selectOneMenu>
       <rich:separator height="1px" style="margin-top:7px;"/>
       </h:panelGrid>
       </a4j:outputPanel>
       </rich:panel>
      
       <h:panelGrid columns="3" style="margin-top:8px;vertical-align:bottom">
       <rich:spacer width="190px" />
      
       <a4j:commandButton action="#{createTaskDialogBean.refreshBean}" reRender="createTaskType"
       onclick="Richfaces.hideModalPanel('taskWizard');"
       value="Cancel" style="float:right; width:110px; height:30px;"/>
       <a4j:commandButton value="Next >>" immediate="true"
       style="float:right; width : 110px; height:30px;"
       styleClass="createTaskStep1Object"
      action="#{createTaskDialogBean.getTaskType}"/>
      </h:panelGrid>
      </ui:composition>
      

      java bean: the bean will be keepalive
      private String taskType = null;
      
      /**
       * select item list for play type combbox
       */
       private List<SelectItem> t_list = null;
       public List<SelectItem> getTaskTypes()
       {
       if(t_list != null){
       return t_list;
       }
       t_list = new ArrayList<SelectItem>();
       SelectItem item = new SelectItem(Constants.IN, "Recording");
       SelectItem item2 = new SelectItem(Constants.OUT, "Playout");
      
       t_list.add(item);
       t_list.add(item2);
       setTaskType(Constants.IN);
       return t_list;
       }
      
      public String getTaskType()
       {
       return taskType;
       }
      
       public void setTaskType(String taskType)
       {
       this.taskType = taskType;
       }
      


      But aperiodic the wizard doesn't work, because of the null value of the selectOneMenu(with debug found, that the getter method getTaskType() return null value). I don't know the reason and difficult to find out. Anybody hat ideas? Thanks in advance.


        • 1. Re: Wizard problem
          nbelaevski

          Hello,

          I suggest that you set conditional breakpoint to setTaskType() with condition taskType == null and check who (and if) is resetting the value.

          • 2. Re: Wizard problem

            thank for your suggest. I will try again.

            • 3. Re: Wizard problem
              ilya_shaikovsky
              • 4. Re: Wizard problem

                i define the wizard outside form, because the modalpanel of the wizard hat already itself form. i have tried to wrap the a4j:commandButton with a4j:region, but doesn't work. The wizard will be caused by others components, break down the binding with backing bean.

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:neo="http://neo.dimetis.de/jsf"
                 xmlns:c="http://java.sun.com/jstl/core">
                
                <ui:composition template="/template.xhtml">
                <ui:define name="Wizards">
                <a4j:include viewId="/createWizard.xhtml" />
                 </ui:define>
                
                </ui:composition>
                


                template.xhtml
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:dim="http://dimetis.de/jsf"
                 xmlns:c="http://java.sun.com/jstl/core">
                
                <head>
                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                 <title>title</title>
                <body>
                <h:form>
                <a4j:region>
                
                 <ui:insert name="Toolbar" />
                 <ui:insert name="Contentbody" />
                 <ui:insert name="Footlbar" />
                </a4j:region>
                </h:form>
                <ui:insert name="Wizards" />
                </body>
                


                dialog.xhtml
                
                <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:c="http://java.sun.com/jstl/core">
                 <rich:modalPanel id="#{dialogId}" moveable ="true" >
                 <h:form>
                 <ui:insert/>
                 </h:from>
                </rich:modalPanel>
                </ui:composition>
                




                • 5. Re: Wizard problem

                  still a question, when use the a4j:commandButton, outside must be wrapped by h:form??? Thanks in advance.

                  • 6. Re: Wizard problem
                    ilya_shaikovsky

                    no seems this ok after you posted additional templates code.

                    follow Nick advice please about null value.