title: ViewScoped Bean get rebuild on commandLink
body: <p>I am building a CRUD app with a dashboard in which the user should be able to partially reload a widget. This is what I got:</p>
  
  <pre><code>   &lt;f:metadata&gt;
      &lt;f:viewParam name="customerUuid" value="# 
      {dashboardManagedBean.customerUuid}" /&gt;
      &lt;f:event type="preRenderView" listener="#{dashboardManagedBean.init}" /&gt;
     &lt;/f:metadata&gt;
  
  &lt;f:view&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
              &lt;p:panelGrid&gt;
                  &lt;p:row&gt;
                      &lt;p:column&gt;
          &lt;p:panelGrid columns="4" styleClass="ui-noborder" 
          style="float:right;"&gt;    
  
                              &lt;p:outputLabel for="dateFrom" value="From:"&gt; 
         &lt;/p:outputLabel&gt;
                              &lt;p:calendar id="dateFrom" value="# 
         {dashboardManagedBean.statisticsRequest.dateFrom}" 
         pattern="dd.MM.yyyy HH:mm:ss" locale="de" readonlyInput="false" 
          timeInput="true" mode="popup"/&gt;
  
                              &lt;p:outputLabel for="dateTo" value="Till:"&gt; 
        &lt;/p:outputLabel&gt;
                              &lt;p:calendar id="dateTo" value="# 
       {dashboardManagedBean.statisticsRequest.dateTo}" pattern="dd.MM.yyyy 
       HH:mm:ss" locale="de" readonlyInput="false" timeInput="true" 
       mode="popup"/&gt;
                          &lt;/p:panelGrid&gt;
  
                      &lt;/p:column&gt;
                  &lt;/p:row&gt;           
                  &lt;p:row&gt;
                      &lt;p:column colspan="3"&gt;
                          &lt;p:panel id="telemetry" header="Telemetrie" 
      style="width: 100%" collapsed="true" toggleable="true"&gt;
                              &lt;f:facet name="actions"&gt;
                                  &lt;p:commandLink
                                          actionListener="# 
     {dashboardManagedBean.loadData}"
                                          styleClass="ui-panel-titlebar-icon 
     ui-corner-all ui-state-default"&gt;&lt;h:outputText
                                          styleClass="fa fa-refresh"/&gt; 
     &lt;/p:commandLink&gt;
                              &lt;/f:facet&gt;
                          &lt;/p:panel&gt;
                      &lt;/p:column&gt;
                  &lt;/p:row&gt;
  
              &lt;/p:panelGrid&gt;
  
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/f:view&gt;
  </code></pre>
  
  <p>And the bean looks like this:</p>
  
  <pre><code>import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.bean.ViewScoped;
  
  @ManagedBean(name = "dashboardManagedBean")
  @ViewScoped @Getter @Setter
  public class DashboardManagedBean implements Serializable {
  
      private Customer customer;
      private StatisticsRequest statisticsRequest;
      private String customerUuid;
  
      public DashboardManagedBean()  {
          this.customer = new Customer();
          this.statisticsRequest = new StatisticsRequest();
      }
  
      public void init() {
       loadCustomer();
       loadData();
      }
  
      public void loadData(){
          // load the customer data by using his the statisticsRequest
  
      }
  
      public void loadCustomer(){
          // load the customer
      }
  }
  </code></pre>
  
  <p>The StatisticsRequest Class is just a wrapper for the request data:</p>
  
  <pre><code>@Getter @Setter
  public class StatisticsRequest {
      private Customer customer;
      private Date dateFrom;
      private Date dateTo;
  
      public StatisticsRequest(){
          java.util.Date da = new Date();
          Calendar cal = Calendar.getInstance();
          cal.setTime(da);
          cal.add(Calendar.MONTH, -4);
          this.dateFrom = cal.getTime();
  
          this.dateTo = new Date();
      }
  }
  </code></pre>
  
  <p>I put this into the constructor of the StatisticsRequest so that I get a reasonable default value when loading the page. However the constructor of the viewscoped bean is called everytime I click on the reload commandLink the date I picked in the calendar is removed and the StatisticsRequest contains the default value again.</p>
  
  <p>Why is this happening?</p>