title: Struts2 session data not available in JSP until I refresh
body: <p>I'm building a Struts2 application, where data is sent to my application in a request header. I have a custom interceptor that grabs this data and uses it to retrieve some data from the database and store it in the session. I then use this session data in the resultant JSP. One problem: the session variable is null until I refresh the page. </p>
  
  <p>Here is my stack:</p>
  
  <pre><code>&lt;interceptor-stack name="myStack"&gt;
      &lt;interceptor-ref name="myInterceptor"/&gt;
      &lt;interceptor-ref name="defaultStack"/&gt;
  &lt;/interceptor-stack&gt;
  </code></pre>
  
  <p>Here is my intercept method in myInterceptor:</p>
  
  <pre><code>ActionContext context = invocation.getInvocationContext();
  HttpServletRequest request = (HttpServletRequest) context.get(StrutsStatics.HTTP_REQUEST);
  HttpSession session =  request.getSession(true);
  
  MyObject obj = new MyObject();
  String header = request.getHeader("HEADER_VALUE");
  if(header != null) {
      obj.loadByHeader(header);
      session.setAttribute("value", obj);
  }
  return invocation.invoke();
  </code></pre>
  
  <p>And here is the JSP code:</p>
  
  <pre><code>&lt;s:if test="#session.value == null"&gt;
      ...
  &lt;/s:if&gt;
  </code></pre>
  
  <p>Like I said, this works when I either refresh or go to another page using this value. Am I doing something wrong? Or can I not get the value until the next time around? If it's the latter, is there an alternative way to get that data on first pass?</p>