Download Excel Using Spring Mvc Session

Active6 years, 2 months ago

Home » Spring Framework » Spring MVC » Spring MVC Excel View Example. Spring MVC Excel View Example. By MemoryNotFound Published May 19, 2016 Updated May 19, 2016. Discover more articles. Download it – spring mvc excel view example.

I'm working with Spring 3 MVC (I'm quite new to it...) and I need some database info to be loaded after user's loggin and stay available until user logs out or closes the web page (I could query the DB each time I need it but it wouldn't be efficient).As far as I know, this should be done through session's management. I've found the following tutorial for managing session data:

Do you think this is a good starting point? Is the 3rd option mentioned the best approach for what I need?When am I supposed to populate the objects that I need to keep in the user's session? Is it OK to do it when the user logs in?

I was also wondering if it is possible to keep some information that should be common to all users (something like a session that is valid for each user).

Thank you very much!!

HauriHauri
2151 gold badge6 silver badges19 bronze badges

1 Answer

I don't think that link is a good starting point. it overly complicates things. There is often no need to change scope of beans, as recommended in the article. In fact having a controller instantiated per request is very inefficient. A new instance of an object would created for every single request - I literally can't think of a worse idea for a scalable performant website.

Spring security makes it easy. Just have a user object containing the relevant data that is returned by your implenetation of the user service.

Download Excel Using Spring Mvc SessionSession management in spring mvc

There is no need to change scope of anything, keep it simple and use the default of singleton (will make scaling easier). And if really necessary use a session attribute.

Using Session In Mvc

Community
NimChimpskyNimChimpsky

Spring Mvc Example

33.9k47 gold badges173 silver badges281 bronze badges
Excel

Download Excel Using Spring Mvc Session 2016

Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Login Form Using Spring Mvc And Hibernate

Not the answer you're looking for? Browse other questions tagged javasessionspring-mvc or ask your own question.