title: Struts2 request as null
body: <p>Very strange error I have, I am getting request as null when I try to access it. I always used the same method to get it, but now I am having this error.</p>
  
  <p><strong>My Action look like this:</strong></p>
  
  <pre><code>package com.deveto.struts.actions;
  
  import com.deveto.hibernate.mappings.Slider;
  import com.opensymphony.xwork2.ActionContext;
  import com.opensymphony.xwork2.ActionSupport;
  import java.util.List;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import javax.servlet.ServletContext;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.struts2.ServletActionContext;
  import org.apache.struts2.util.ServletContextAware;
  
  
  /**
   *
   * @author denis
   */
  public class ContentAction extends ActionSupport implements ServletContextAware {
  
  HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
  HttpServletResponse response = (HttpServletResponse) ActionContext.getContext().get(ServletActionContext.HTTP_RESPONSE);
  ActionContext ac = ActionContext.getContext();
  ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);
  
  @Override
  public String execute() throws Exception {
  
      System.out.println("request: " + request);
  
      return SUCCESS;
  }
  
  public ActionContext getAc() {
      return ac;
  }
  
  public void setAc(ActionContext ac) {
      this.ac = ac;
  }
  
  public HttpServletRequest getRequest() {
      return request;
  }
  
  public void setRequest(HttpServletRequest request) {
      this.request = request;
  }
  
  public HttpServletResponse getResponse() {
      return response;
  }
  
  public void setResponse(HttpServletResponse response) {
      this.response = response;
  }
  
  public ServletContext getSc() {
      return sc;
  }
  
  public void setSc(ServletContext sc) {
      this.sc = sc;
  }
  
  public void setServletContext(ServletContext sc) {
      this.sc = sc;
  }
  }
  </code></pre>
  
  <p>And now I can't do nothing, the request is always null</p>
  
  <pre><code> request: null
  </code></pre>