title: Struts2 custom login interceptor
body: <p>Can someone explain me how to write a custom login interceptor that checks username, password and also checks if the users validity date is greater than the current date. Im  new to java programming &amp; struts 2...i would really appreciate step by step info. I get the username, etc info by manual jdbc connection...i have a jndi setup for that. This also needs to have session management. </p>
  
  <p>So a step by step with the following code samples would be nice,</p>
  
  <p>1) The dao using jndi to get username,etc from DB</p>
  
  <p>2) The login action with session aware</p>
  
  <p>3) interceptor</p>
  
  <p>4) login.jsp</p>
  
  <p>5) struts.xml definition for the interceptor</p>
  
  <p>6) task.jsp and task2.jsp ( internal pages that can only be seen if user is logged in)</p>
  
  <p>Thank you!</p>