1 Reply Latest reply on Jan 8, 2010 3:13 PM by Nick Belaevski

    issue with rerendering tag in main page from modalpanel

    lalit lee Newbie

      I have some problem with modal panel
      i want to render a outputText field in parentwindow on button click in modalpanel
      this works when i directly put the button in modalpanel,but does not work if i include the button in a page which is included in modalpanel

      follwing is the code sample

       

      parentpage.jsp
      --------------------

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
      <f:view>
        <a4j:page>
         <h:form id="myform">
          <h:outputText id="outputval" value="#{parentpage.outputval}"></h:outputText>
          <a4j:commandLink value="Click Here"
           onclick="#{rich:component('wizard')}.show()"></a4j:commandLink>
         </h:form>
         <rich:modalPanel id="wizard" width="610" height="500"
          autosized="false">
          <f:facet name="header">
           <h:outputText value="Modal panel"></h:outputText>
          </f:facet>
          <f:facet name="controls">
           <h:graphicImage id="close_window" value="/images/icons/delete.gif"
            style="cursor:pointer"
            onclick="#{rich:component('wizard')}.hide()">
           </h:graphicImage>
          </f:facet>
          <h:panelGrid id="include">
           <a4j:outputPanel>
            <h:form>
             <a4j:commandButton actionListener="#{parentpage.changeoutputval}"
              reRender="myform:outputval" value="modal direct click"></a4j:commandButton>
            </h:form>
            <ui:include id="a4j_include" src="/tests/includetest.jsp"></ui:include>
           </a4j:outputPanel>
          </h:panelGrid>
         </rich:modalPanel>

        </a4j:page>
      </f:view>
      </ui:composition>


      includetest.jsp
      ------------------
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
      <f:subview id="includedsubview">
        <a4j:page>
         <h:form>
          <a4j:commandButton actionListener="#{parentpage.changeoutputval}"
           reRender="myform:outputval" value="modal included click"></a4j:commandButton>
         </h:form>
        </a4j:page>
      </f:subview>
      </ui:composition>

      parentpage.java
      ———————

      package com.test;

      import javax.faces.event.ActionEvent;

      public class parentpage {
      private String outputval;
      private int count;

      public parentpage() {
      // TODO Auto-generated constructor stub
      outputval = “Before Change”;
      count=0;
      }

      public String getOutputval() {
      return outputval;
      }

      public void setOutputval(String outputval) {
      this.outputval = outputval;
      }

      public void changeoutputval(ActionEvent event) {
      outputval = “Got that”;
      }
      }

      Click on “modal direct click” outputval is updated
      Click On “modal included click” outputval is not updated

      Please guide me in this regard..