title: How to get ActionForm in Struts 2?
body: <p>I am migrating an Struts 1 app to Struts2 and trying to minimize the code changes required.</p>
  <p>I need to know how to access the <code>ActionForm</code> in a Struts2 <code>Action</code> class. Below is my current code and I am getting NPE when trying to access <code>ActionForm</code>.</p>
  <pre><code>Public class DeptBuildingNewAction extends ActionSupport 
  implements ServletRequestAware, ServletResponseAware,  ModelDriven&lt;DeptBuidingFormBean&gt; {
  
  private HttpServletRequest request;
  private HttpServletResponse response;
  private DeptBuidingFormBean form;
  
  public void setServletRequest(HttpServletRequest httpServletRequest) {
      this.request = httpServletRequest;
  }
  
  public void setServletResponse(HttpServletResponse httpServletResponse) {
      log.debug(&quot;Inside setServletResponse&quot;);
      this.response = httpServletResponse;
  }
  
  public DeptBuidingFormBean getModel() {
      log.debug(&quot;Inside getForm&quot;);
      return form;
  }
  
  public void setModel(DeptBuidingFormBean form) {
      log.debug(&quot;Inside setForm&quot;);
      this.form = form;
  }
  </code></pre>
  <p>What is the best way to get the <code>ActionForm</code> over here?</p>