title: How to get data from spring beans class?
body: <p>I am developing a web application for that have created a bean class where all setter and getter method exist like:</p>
  
  <pre><code>private String LeaveType;
  private String leavePeriod;
  
  private String reason;
  private String FirstApprover;
  
  private String finalApprover;
  private String selectHours;
  
  public String getLeaveType() {
      return LeaveType;
  }
  
  public void setLeaveType(String leaveType) {
      LeaveType = leaveType;
  }
  
  public String getLeavePeriod() {
      return leavePeriod;
  }
  
  public void setLeavePeriod(String leavePeriod) {
      this.leavePeriod = leavePeriod;
  }
  
  public String getReason() {
      return reason;
  }
  
  public void setReason(String reason) {
      this.reason = reason;
  }
  
  public String getFirstApprover() {
      return FirstApprover;
  }
  
  public void setFirstApprover(String firstApprover) {
      FirstApprover = firstApprover;
  }
  
  public String getFinalApprover() {
      return finalApprover;
  }
  
  public void setFinalApprover(String finalApprover) {
      this.finalApprover = finalApprover;
  }
  
  public String getSelectHours() {
      return selectHours;
  }
  
  public void setSelectHours(String selectHours) {
      this.selectHours = selectHours;
  }
  </code></pre>
  
  <p>In above class the details from the html page gets saved temprory when click ob submit that data I want to fetch it in my another controller class by creating object of that class rather than fetching it from database, and I have tried but getting null values so,Is there any way to get out of this issue.
  cotrooler class:</p>
  
  <pre><code>@RequestMapping(value = "/leaveapplyform", method = RequestMethod.GET)
         public String showForm(ModelMap model,HttpServletRequest request) 
         {
           log.info("Inside Controller returning to leaveapplyform page....");
  
           LeaveApplyForm leaveapplyform =  new LeaveApplyForm();
          model.put("leaveapplyform", leaveapplyform);    
  
  
      return GlobalConstants.LEAVE_APPLY; 
         }
  
  
  @RequestMapping(value = "/leaveapplyform" ,method = RequestMethod.POST)
      public String processForm(@ModelAttribute("leaveapplyform") LeaveApplyForm leaveapplyform,HttpServletRequest request, HttpServletResponse response, ModelMap model)
      {
          leaveapplyform = (LeaveApplyForm) model.get("leaveapplyform");
  System.out.println(leaveapplyform.getReason());//Here goes wrong
  
  }}
  </code></pre>