title: SessionTimeout: web.xml vs session.maxInactiveInterval()
body: <p>I'm trying to timeout an <em>HttpSession</em> in Java. My container is WebLogic.</p>
  
  <p>Currently, we have our session timeout set in the <em>web.xml</em> file, like this
  </p>
  
  <pre><code>&lt;session-config&gt;
      &lt;session-timeout&gt;15&lt;/session-timeout&gt;
  &lt;/session-config&gt;
  </code></pre>
  
  <p>Now, I'm being told that this will terminate the session (or is it all sessions?) in the 15th minute of use, regardless their activity.</p>
  
  <p>I'm wondering if this approach is the correct one, or should I programatically set the time limit of inactivity by
  </p>
  
  <pre><code>session.setMaxInactiveInterval(15 * 60); //15 minutes
  </code></pre>
  
  <p>I don't want to drop all sessions at 15 minutes, only those that have been inactive for 15 minutes.</p>
  
  <p>Are these methods equivalent? Should I favour the <em>web.xml</em> config?</p>