| Author |
User Session - Servlet or SFSB
|
Ranganathan Kaliyur Mannar
Bartender
Joined: Oct 16, 2003
Posts: 927
|
|
For maintaining user sessions in a web app. which one is best from an 'exam' point of view? Servlets or Stateful Session Beans? Ranga.
|
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
|
 |
J J Wright
Ranch Hand
Joined: Jul 02, 2008
Posts: 254
|
|
|
check out http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html#1083750
|
SCJP, SCWCD, SCBCD, SCEA 5
|
 |
ShreeRam Manivannan
Greenhorn
Joined: Jul 09, 2008
Posts: 8
|
|
|
HI, Any stright forward answers for this question?.
|
 |
J J Wright
Ranch Hand
Joined: Jul 02, 2008
Posts: 254
|
|
I thought the Blueprints were pretty straight-forward! 4.4.7.3 Web-Tier State Recommendations When using enterprise beans, it's best to maintain session state with stateful session beans in the EJB tier. For Web-only applications, maintain the state in the Web tier as session attributes (using HttpSession).
|
 |
ShreeRam Manivannan
Greenhorn
Joined: Jul 09, 2008
Posts: 8
|
|
|
Thanks Jonathan Aotearoa for making it clear.
|
 |
Ranganathan Kaliyur Mannar
Bartender
Joined: Oct 16, 2003
Posts: 927
|
|
Well...thats where the confusion is...in some of the mock exams, it was quite clear Enterprise Beans was going to be used. But for some reason, Servlets were preferred to maintain the user sessions. It was not completely clear why... Thanks for your replies, Ranga.
|
 |
Lann Lu
Ranch Hand
Joined: May 31, 2008
Posts: 45
|
|
There was one project, we didn't have users session data in memory at all. We persist session data to database, and the outcome is "surprisingly" good in terms of performance and simplicity. Upon each click, application goes to database to retrieve the session data. This also makes clustering simple. Most vendors support persisting http session to database automatically, but this explicit approach is quite different though. Of course there are many downsides of approach, it may work for a narrow business domain. Peace, Tao
|
 |
Phil Haigh
Greenhorn
Joined: Jan 19, 2006
Posts: 26
|
|
Originally posted by ShreeRam Manivannan: HI, Any stright forward answers for this question?.
ShreeRam, The straight answer is that you as architect decide which approach you are going to use, and justify that choice. There may be a particular requirement that means you are driven to select one apporach over the other. If there isn't then you should be looking to justify your choice in terms of non-functional requirements. None of the assignments have a single solution that you are expected to 'find', the examiners are looking for 'appropriate' choices and reasoned technical argument (expressed through your assumptions and design decisions) to back up those choices. This applies to all the choices you make during the assignment - either there is a constraint within the information you are given that guides you down a route (stateless versus stateful, container managed persistence versus bean, etc) or there is not. When there is not you are expected to make an 'appropriate choice' and justify it in terms of the JEE architecture. That is, after all, at the core of being a software architect.
|
Phil
SCJP, SCWCD, SCEA
|
 |
Lann Lu
Ranch Hand
Joined: May 31, 2008
Posts: 45
|
|
Exactly. Phil has the points.
|
 |
 |
|
|
subject: User Session - Servlet or SFSB
|
|
|