title: MVC SPRING - org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
body: <p>I got HttpStatus 500 with nested exception and java.lang.NullPointerException<br>
  im making a multicurrency converter i used to debug when it get here the error starts <em>currencypojo.setAmount(BigDecimal.valueOf(Integer.parseInt((request.getParameter("txtAmount")))));</em></p>
  
  <p><strong>MultiCurrencyController.java</strong></p>
  
  <pre><code>package com.multicurrency;
  
  import java.math.BigDecimal;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.springframework.web.servlet.ModelAndView;
  import org.springframework.web.servlet.mvc.AbstractController;
  
  public class MultiCurrencyController extends AbstractController{
  
      private MultiCurrencyPOJO currencypojo;
      @Override
      protected ModelAndView handleRequestInternal(HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          currencypojo.setAmount(BigDecimal.valueOf(Integer.parseInt((request.getParameter("txtAmount")))));
          currencypojo.setCurrency(request.getParameter("currency"));
          return new ModelAndView ("home","CurrencyInfo",currencypojo);
      }
  
      public void multiCurrencyPOJO(MultiCurrencyPOJO currencypojo){
          this.currencypojo=currencypojo;
      }
  }
  </code></pre>
  
  <p><strong>MultiCurrencyPOJO.java</strong></p>
  
  <pre><code>package com.multicurrency;
  
  import java.math.BigDecimal;
  
  
  
  public class MultiCurrencyPOJO {
      private String currency;
      private BigDecimal amount;
  
      public String getCurrency() {
          return currency;
      }
      public void setCurrency(String currency) {
          this.currency = currency;
      }
      public BigDecimal getAmount() {
          return amount;
      }
      public void setAmount(BigDecimal amount) {
          this.amount = amount;
      }
  
      public static BigDecimal getExchangeRate(String currency) {
          return null;
  
      }
  }
  </code></pre>