Web tier: servlets, JSP, Web frameworks: How to call stateless session bean from a servlet or JSP
First of all tell me when to use EJB and when to use only Jsps and sevlets??
- Posted by: Richa Pandharikar
- Posted on: September 24 2002 14:55 EDT
Can anyone help me out on this???
How can I call thestateless session from a jsp and how do I transfer the parameters from jsp/servlet to Session bean???
- How to call stateless session bean from a servlet or JSP by Sameer Desawale on September 25 2002 01:38 EDT
- How to call stateless session bean from a servlet or JSP by Raj S on September 25 2002 03:50 EDT
- How to call stateless session bean from a servlet or JSP by Raj S on September 25 2002 04:39 EDT
- How to call stateless session bean from a servlet or JSP by Raj S on September 25 2002 04:43 EDT
To answer your first question ... if you've ever heard of the MVC (Model-view-controller) pattern or n-tier pattern of development, then the JSP/Servlets are the 'View' part of it - or the 'Presentation' layer in the n-tier system. Meaning, they are primarily responsible just for displaying the data & accepting input. To some extent JSP/Servlets can be 'Controllers', i.e. they can control/define the flow of an application.
However, it is bad design to put your 'Model' part (i.e. the 'business logic' part) in JSP/Servlets. That is what you use the EJBs for. EJBs (Session/Entity/Message) should ideally be used to handle the business rules part of your app. This allows your app to easy to maintain when there are changes & also provides you with all benefits of the J2EE architecture - i.e. scalability, security, pooling, transactions, distribution, messaging & naming.
My advice ? Try to put display logic in JSP/Servlets & put your business logic in EJBs - easy as pie.
Here are links for first question...
This will help you deciding When to use EJBs...
You can have a look at this link for calling Stateless Session bean from either JSP or Servlet
Sorry Here is the link