Announcement Announcement Module
Collapse
No announcement yet.
How to add the same model data to every view? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to add the same model data to every view?

    Hi all,

    I would like to display some model data in the header of each page. Specifically, the full name of the logged in user. I'm using Tiles right now, but would be happy to switch to Sitemesh if that can provide a solution.

    For the case of the currently logged in user I'll probably end up doing it by using the Spring Security authentication taglib and adding the full name to a subclass of UserDetails, but it has me wondering how this sort of thing would be done for other types of data that are not available via the SecurityContext.

    So, what is the best way to ensure that a particular piece of data is added to the model returned by every controller?

    Thanks

  • #2
    Interceptor!


    http://static.springsource.org/sprin...ng-interceptor

    Comment


    • #3
      That looks to be exactly what I need.

      Thanks very much for the advice.

      Comment

      Working...
      X