Controller logic in Servlets or Session Beans


General J2EE: Controller logic in Servlets or Session Beans

  1. Controller logic in Servlets or Session Beans (1 messages)


    I'm looking into buildingan application with standard Model 2 Servlet/JSPs as presentation (MVC), calling an existing API (EJBs) on a remote appserver.

    I'm not sure where to put the logic for the controller of the presentation, to call the EJBs and call the JSPs with appropriate results.

    Should all this logic be on the web-tier, in the servlets or on the app server as statfull session beans ?

    Does anyone know the benefits of both (or is one just plain stupid !)

    Any help greatly appreciated,
  2. Build your app so you can drive it from the command line, sqing, and html. To do so:

    1 JSPs contain layout. Use struts to do form processing
    2 Actions are struts items to get infomration needed from the environment to build messages for EJBs
    3 Commmunicate with you ejbs via flat value objects. By flat, I mean they should be like structs from C. The long term affect is that you could eventually rewrite your fron end to communicate VIA Corba.

    All buisness processing takes place in EJBs. I have yet to make a stateful EJB, but that was a design decision from early on that we are still living with.