1 Reply Latest reply on May 19, 2010 6:13 PM by natalibr

    dataModelSelection returning null after modal editing

    natalibr

      Hello everybody


      I'm working at my first project using seam/jsf. I'm trying to edit values in a modal-form, but when I click on the submit button I get the following exception:


      Can someone help to understand what is going on?


      Thanks


      Exception during request processing: Caused by javax.servlet.ServletException with message: javax.el.PropertyNotFoundException: /parametros.xhtml @103,100 value=${parametros.configuracao2Record.parametro}: Target Unreachable, 'configuracao2Record' returned null on 'br.xxx.admin.core.components.action.ParametrosAction$$javassistseam3'


      --------------------


      MY BEAN


      @Name("parametros")
      @Scope(ScopeType.CONVERSATION)
      public class ParametrosAction extends SuperManagedBean {

          @DataModel
          private List<IConfiguracao2> configuracao2List;

          @DataModelSelection
          private IConfiguracao2 configuracao2Record;

          @Logger
          private Log log;

          @SuppressWarnings("unchecked")
          @Factory("configuracao2List")
       
          @Begin
          public String redirect() {

              return "parametros";
          }

         
          public void update() {

              try {
                  ConfigRemote configRemote;
                  configRemote = ServiceFinder.find("ConfigService", ConfigRemote.class);
                  configRemote.update(configuracao2Record);
              } catch (ClassCastException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (NamingException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }

          }

          public IConfiguracao2 getConfiguracao2Record() {

              return configuracao2Record;
          }

          public void setConfiguracao2Record(IConfiguracao2 config) {

              configuracao2Record = config;

          }

      }

      ------------


      MY MODAL
      <rich:modalPanel id="mpParametro" resizeable="false" moveable="true" width="400" autosized="true">
                  <f:facet name="header">
                      <h:outputText value="#{messages.PARAMETROS_ABA_2}" />
                  </f:facet>
                  <f:facet name="controls">
                      <h:panelGrid columns="1" width="100%"
                          style="vertical-align: middle; text-align: right;">
                          <h:graphicImage value="#{messages.IMAGE_JANELA_FECHAR}"
                              style="cursor:pointer;"
                              onclick="Richfaces.hideModalPanel('mpParametro')" />
                      </h:panelGrid>
                  </f:facet>
                  <a4j:form>
                      <h:panelGrid width="100%" columns="2">
                          <h:outputText value="#{messages.PARAMETROS_TAB_1_COL_1}" />
                          <h:inputText value="#{parametros.configuracao2Record.parametro}" maxlength="40" />
                          <h:outputText value="#{messages.PARAMETROS_TAB_1_COL_2}" />
                          <h:inputText value="#{parametros.configuracao2Record.descricao}" maxlength="40" />
                          <h:outputText value="#{messages.PARAMETROS_TAB_1_COL_3}" />
                          <h:selectOneMenu id="tipoParametro"
                                          value="#{parametros.configuracao2Record.tipo}"
                                          style="width: 100%;">
                                          <f:selectItem itemValue="string" itemLabel="String" />
                                          <f:selectItem itemValue="integer" itemLabel="Integer" />
                                      </h:selectOneMenu>
                          <h:outputText value="#{messages.PARAMETROS_TAB_1_COL_4}" />
                          <h:inputText value="#{parametros.configuracao2Record.valor}" maxlength="40" />
                      </h:panelGrid>
                      <h:panelGrid id="botoes" columns="1" width="100%" style="text-align: center;">
                          <h:panelGroup>
                              <a4j:commandButton id="bt_cancelar"
                              value="#{messages.PARAMETROS_BT_6}" onclick="Richfaces.hideModalPanel('mpParametro')"
                              oncomplete="this.disabled=false" reRender="richTabPanel"
                              style="#{propSkin.borda_botoes}" />
                                    
                              <rich:spacer width="10" />
                                    
                              <a4j:commandButton id="bt_alterar"
                              action="#{parametros.update}"
                              value="#{messages.PARAMETROS_BT_5}"
                              onclick="this.disabled=true" oncomplete="this.disabled=false"
                              reRender="richTabPanel"
                              style="#{propSkin.borda_botoes}"/>
                          </h:panelGroup>                           
                      </h:panelGrid>
                  </a4j:form>
              </rich:modalPanel>

        • 1. Re: dataModelSelection returning null after modal editing
          natalibr

          I found the solution.
          To make the modal works correctly was necessary to change the @Scope to PAGE.


          At the moment I can't understand exactly why I can't use the conversation scope type in this situation. I think when we open a modal panel is created a new conversation and isn't possible to interact with objects outside the current.


          Does anyone have an explanation?


          Thanks