title: Best way to show the user full name in a JSP header file with a spring/struts framework?
body: <p>I have a JSP struts application that uses Spring to integrate with the services/dao/database. Basically, struts uses spring to get the data from the DB, it builds the form and forward them to the JSP files. </p>
  
  <p>I have a header file that is injected in each JSP file using Tiles. I would like to show "Welcome John Doe" on each page inside the header. Where "John Doe" is the name of the currently logged user.</p>
  
  <p>What would be the best approach to do that? The solution that I can think of is:</p>
  
  <ol>
  <li><p>Use a Spring Filter the catch the http request. Load the user from the database using a cookie that contains the user id(*) and put the name in a session bean named "CurrentUser"</p></li>
  <li><p>In "header.jsp", get the spring application context. Using it, load the bean "CurrentUser" and get the name. Put the name in the html.</p></li>
  </ol>
  
  <p>I think I could get this to work. But I'm not certain this is the best way to do it. Any thought on my approach?</p>
  
  <hr>
  
  <p>(*) Of course, the cookie will be encrypted</p>