• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Best way in Spring 3 with annotation to provide an object in all views

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Craig,

I like to have an object (e.g. The User object out of the database or the Version of the project) to be available in all my views.
I hate to insert lookup code into my jsp that I could do. Rather I like to have a already correctly formated object delivered from my controller.
But I do not want to do that programatically in all my controllers.
Have you a suggestion how to do that without having too much code in my jsps?

We are using spring 3.0.1 and hibernate on a tomcat 6.
A small code snipet would be appreciated.

Thanks a lot.
Kind Regards
Michael
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's the logged in user, if you are using spring security, the tag libraries give you access to the authentication object, hence the logged in user object. If it's any other object, you can add it to the HTTP session or to the application context, depending on the scope you want this object to be. It's not spring specific.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic