Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Controller -Servlet or Session Bean ?

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I was wondering if any of you guys can give me a few "thumb rules" on when to use a Servlet for a controller / State Management, and when to use statefull session bean. I keep mix between the 2.
thanks
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i agree with u in keeping a mix often.
For state, one indicator is ur deployment scenario.
If ur websvr is clustered, rely more on stateful SB for state.
If both websvr & appsvr r clustered, go for a mix.
 
E. Messing
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah - this makes sense..
However - i spotted some mock questions that didnt stated deployment env' issues. Some of the answers were of "Servlet as controller / Servlet for state holding " and some choose "Session Beans".
When the answer is Servlet, the explanasion is always "No need for Session bean". As i see it - Session bean is more heavy, but more scalable. Servlet is lightweight, but less flexible..
So - when to use what ?
 
Nishant Anshul
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I m afraid most of the times answers in such tests do not take a exhaustive view. But to be fair, in such boundary questions, people might come up with varied opinions. On more simplfied and raw terms, u can always assume :-
1)When the state u r holding in ur web layer is to be propagated across ejbs also, u got to have both approaches. May be have a java object placed in HttpSession (or Custom Web Svr own session like IBMHttpSession), then persist it through replication (bcz likely u r on clustered env in production cases), and then maintain a ref to a stateful SB which will in turn be persisted thru passivation.
example is a simple http session shopping cart holding some local entity ref thru session facade
2)In simple cases when u r just concerned with navigation and state maintainance till web svr layer, always go for Svt
Messing, in all likelihood u r knowing these. I just summarised it. Byee..
 
E. Messing
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you far clarifying that
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic