• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to set the scope of an object in controller

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone

i am working with spring&hibernate, i want to set scope to an object that is created in the controller.

can anyone help me in this regard.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please add more detail. Not sure what you mean by scope here, or created in Controller means.

Thanks

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

If you mean to say that you are using a dependency injection for an object in the controller then in that case you can use the scope attribute for the bean tag.
It will be more clear if you elaborate on the type of problem that you are facing... and need for setting the scope of the object.

Regards,
Suhas
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for your replies, sorry for not making the point so clear.

let me make it more clear, i want to access an object in all my jsp's(at-least in more than one), the object which i am talking about will be returned from my controller as a model object(ModelAndView), the object gets its content by making a dao call in my controller, now i want to set the scope for this object (preferably session scope) so that i can access my object in more than one jsp.

i also used ServletContextAware interface, whose implementation class has been injected into spring configuration xml file as a bean, i cannot use this way because my dao call depends on some parameters. now let me know which way i have to use to set the scope of the object so that i can access in any of my jsp.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have finally rectified that
thank you for those who have come across this post and posted their replies.
come up even with your solution as your approach may be different with mine.

i hve set in my controller class using
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am once again stuck i am able to get the object but not its content.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic