title: Data from JSF page (XHTML) is not setting into the object whose reference passed in managed bean.
body: <pre><code>    My XHTML:--&gt;
  
      &lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
     &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
      &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"`enter code here`
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
          xmlns:p="http://primefaces.org/ui"
      template="/templates/mainTemplatePage.xhtml"&gt;
  
      &lt;ui:define name="content"&gt;
          &lt;h:form id="addProduct"&gt;
  
  
      &lt;f:loadBundlebasename="com.erudishield.framework.propertyfile.
      ScreenConstants"
                  var="constants" /&gt;
              &lt;f:loadBundle
  
      basename="com.erudishield.framework.propertyfile.ScreenButtonNameConstants"
                  var="buttonConstant" /&gt;
              &lt;p:panel id="addProductPanel"&gt;
  
                  &lt;h:panelGrid columns="3"&gt;
                      &lt;h:outputLabel value="Add Product" /&gt;
  
              &lt;!--        &lt;h:outputLabel
                          value="#
      {addProductBB.screenDisplayData.message.screenResponseMessageForAddProduct}"
                          rendered="#
      {addProductBB.renderer.productDataRenderer.productTextRenderer}"
                          style="#  
      {productMaintenanceBB.screenDisplayData.message.screenResponseMessageColor}"
                          styleClass="outputText" escape="false"&gt;
                      &lt;/h:outputLabel&gt;
       --&gt;
                  &lt;/h:panelGrid&gt;
  
                  &lt;h:panelGrid columns="2" cellpadding="5"&gt;
                      &lt;h:outputText id="outputText" value="#
      {constant.screenDisplayData.productName}"&gt;&lt;/h:outputText&gt;
                      &lt;p:inputText id="addProductInput"
                          value="#{addProductBB.screenDisplayData.productName}"&gt;  
      &lt;/p:inputText&gt;
                  &lt;/h:panelGrid&gt;
  
                  &lt;p:spacer width="415" height="20" /&gt;
                  &lt;h:panelGrid&gt;
                      &lt;p:commandButton value="#{buttonConstant.addProduct}"
                          update=":addProduct" action="#         
      {addProductBB.addProductAction}"&gt;    &lt;/p:commandButton&gt;
                  &lt;/h:panelGrid&gt;
  
              &lt;/p:panel&gt;
  
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
      &lt;/ui:composition&gt;
  
  -------------------------------------------
  
      Managed Bean:
  
      package com.erudishield.erudishieldweb.bb.businessProcess;
  
      import java.io.Serializable;
  
      import javax.annotation.PostConstruct;
     import javax.faces.bean.ManagedBean;
     import javax.faces.bean.ViewScoped;
  
     import com.erudishield.erudishieldutil.validator.StringValidator;
      import com.erudishield.erudishieldweb.bb.businessProcess.bo.
      AddProductScreenDisplayData;
       import com.erudishield.erudishieldweb.bd.AddProductBD;
      import com.erudishield.erudishieldweb.bo.businessProcess.ProductRenderer;
      import com.erudishield.framework.application.constants.ApplicationConstants;
      import com.erudishield.framework.messages.MessageConstants;
      import com.erudishield.service.businessprocess.bo.AddProductBO;
      import com.erudishield.service.businessprocess.bo.AddProductPKBO;
      import    com.erudishield.service.businessprocess.bo.
      AddProductScreenResponseMessageBO;
      import com.erudishield.service.businessprocess.bo.ProductBO;
      import com.erudishield.service.businessprocess.bo.ProductPKBO;
  
      @ManagedBean
      @ViewScoped
      public class AddProductBB implements Serializable {
  
      private static final long serialVersionUID = -1089990299636039243L;
  
      private AddProductScreenDisplayData screenDisplayData;
      private ProductRenderer renderer;
      private String addProductName;
      private AddProductScreenResponseMessageBO message;
  
      public AddProductScreenDisplayData getScreenDisplayData() {
  
          return screenDisplayData;
      }
  
      public void setScreenDisplayData(
              AddProductScreenDisplayData screenDisplayData) {
          this.screenDisplayData = screenDisplayData;
      }
  
      public ProductRenderer getRenderer() {
  
          return renderer;
      }
  
      public void setRenderer(ProductRenderer renderer) {
          this.renderer = renderer;
      }
  
  
      @PostConstruct
      public void init() {
  
            AddProductScreenDisplayData screenDisplayData = new
            AddProductScreenDisplayData();
            setScreenDisplayData(screenDisplayData);
           ProductRenderer renderer = new ProductRenderer();
           setRenderer(renderer);
  
      }
  
      public void addProductAction() {
          System.out.println("Entering in method addProductAction");
      /*        initializeAllScreenMesages();
            getMessage().setScreenResponseMessageForAddProduct("");
      */       
          if (productDataValidation()) {
              getScreenDisplayData().getMessage().setScreenResponseMessageColor
      (ApplicationConstants.ERROR_MESSAGE_COLOR);
          }
          else {
  
              AddProductBO addProductBO = convertScreenDataToAddProductBO();
  
              AddProductBO productBO = new AddProductBD().addProduct(
                      addProductBO, getMessage());
  
              if (productBO.getId() == 0) {
  
                  commonScreenMessageRendering(
                          ApplicationConstants.ERROR_MESSAGE_COLOR,
                          getScreenDisplayData().getMessage()
                                  .getScreenResponseMessageForAddProduct(),"Add");
              } else {
                  commonScreenMessageRendering(
                          ApplicationConstants.SUCCESS_MESSAGE_COLOR,
                          MessageConstants.SUCCESS_PRODUCT_CREATED,"Add");
              }
          }
      }
  
      /*
       * public void commonMessageRendering(String message, String messageColor) {
       * getScreenDisplayData().getMessage().setScreenResponseMessageColor(
       * messageColor); getScreenDisplayData().getMessage()
       * .setScreenResponseMessageForAddProduct(message);
       * 
       * }
       */
  
      public void commonScreenMessageRendering(String message,
              String messageColor, String action) {
  
          if (action.equals("Add")) {
              getScreenDisplayData().getMessage()
                      .setScreenResponseMessageForAddProduct(message);
          }
          getScreenDisplayData().getMessage().setScreenResponseMessageColor(
                  messageColor);
      }
  
      public void initializeAllScreenMesages() {
          getScreenDisplayData().setMessage(
                  new AddProductScreenResponseMessageBO());
  
      }
  
      public AddProductBO convertScreenDataToAddProductBO() {
          AddProductBO addProductBO = new AddProductBO();
          addProductBO.setProductName(getAddProductName());
          return addProductBO;
      }
  
      public boolean productDataValidation() {
          boolean isError = false;
  
          if       (StringValidator.isBlankOrNull(getScreenDisplayData().
      getProductName())) {
              //getScreenDisplayData().setProductName("");
              getScreenDisplayData().getMessage()
                      .addScreenResponseMessageForAddProductPanel(
                              MessageConstants.ERROR_PRODUCT_NAME_REQUIRED);
              isError = true;
          } else if (getAddProductName().length() &gt;= 100) {
              //setAddProductName("");
              getScreenDisplayData().getMessage()
                      .addScreenResponseMessageForAddProductPanel(
                              MessageConstants.ERROR_LENTHIER_PRODUCT_NAME);
              isError = true;
          }
          return isError;
      }
  
      public String getAddProductName() {
          return addProductName;
      }
  
      public void setAddProductName(String addProductName) {
          this.addProductName = addProductName;
      }
  
      public AddProductScreenResponseMessageBO getMessage() {
          return message;
      }
  
      public void setMessage(AddProductScreenResponseMessageBO message) {
          this.message = message;
      }
  
      }
  
  -------------------------------------------------------
      AddProductScreenDisplayData class
  
      package com.erudishield.erudishieldweb.bb.businessProcess.bo;
  
      import java.io.Serializable;
      import java.util.List;
  
      import       com.erudishield.service.businessprocess.bo.
      AddProductScreenResponseMessageBO;
  
      public class AddProductScreenDisplayData implements Serializable {
  
      /**
       * 
       */
      private static final long serialVersionUID = 8033274203833911923L;
  
      private String productName;
      private AddProductScreenResponseMessageBO message;
      private String testScreenDisplay;
  
      //  private List&lt;Object&gt; productList;
  
  
      public String getProductName() {
          return productName;
      }
  
      public void setProductName(String productName) {
          this.productName = productName;
      }
  
      public AddProductScreenResponseMessageBO getMessage() {
          return message;
      }
  
      public void setMessage(AddProductScreenResponseMessageBO message) {
          this.message = message;
      }
  
      public String getTestScreenDisplay() {
          return testScreenDisplay;
      }
  
      public void setTestScreenDisplay(String testScreenDisplay) {
          this.testScreenDisplay = testScreenDisplay;
      }
      }
  </code></pre>
  
  <p>=========================================================
  My question is when i am taking input from user product name and setting it to variable productName which is in AddProductScreenDisplayData object, it is setting null(It seems like it is setting null). And code breaks. I put System.out.println() statement to ensure if its entering into the addProductAction() method. Flow is entering into the method but when few validations are checked code flow breaks again. But instead of setting in AddProductScreenDisplayData if i set the product name in managed bean itself, then everything works perfectly fine. Please help me out. Where is the problem</p>