Author | Message |
---|---|
cshah6
Posts: 19
|
Posted 15:55 May 25, 2014 |
Hello professor,
Can you guide me that, How can I use application scope in spring controller to use any thing on application level as we used in JSP servlet. If possible please give any demo or example.
|
cysun
Posts: 2935
|
Posted 16:51 May 25, 2014 |
You don't need application scope in a Spring application. Any Spring bean can effectively serve as "application scope" because a bean will live as long as the application is running. In other words, you can use a bean to store any data that you would use application scope to store in a servlet application. An example of this is the Who's Online example: the WhosOnlineService bean is used to hold the list of deferred results. |
cshah6
Posts: 19
|
Posted 16:57 May 25, 2014 |
Though as we use HttpSession session in our controller , can we use HttpServletRequest request and use session scope as we do in servlet applicaiton? Its allowed right ? |
cysun
Posts: 2935
|
Posted 16:59 May 25, 2014 |
Yes, it's OK to use HttpServletRequest and HttpSession when necessary. |