Friends, Anybody can answer following questions ? 1. Why to use JSP or Java Bean or EJB, when everything can be done with Servlets ? => Bean and EJB is reusable component so one can understand the use for Bean and EJB, But why servlet or Jsp ? 2. Moreover, Which things (java code), i need to put at Jsp and which code i need to put at Servlet and again which code should be at Bean/EJB ? 3. Anybody can help to implement MVC Architecture with J2EE technology ? Thanks and regards Dharmin (SCJP)
SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
1. Why to use JSP or Java Bean or EJB, when everything can be done with Servlets ? 2.
Jsp is used sometimes instead of Servlets - servlets mix Presentation with business logic . Its very important to seperate different layers. like jsp pages are maintained by design team , and business logic is responsibility of the Development team, and so on..... its very-2 important for extensiblity.
we use JSP with Beans , because there should be ideally minimal java code in JSP , so we write business logic in Beans and call the beans from JSP. so that desinger only deals with <jsp:useBean>
with EJB you can write Enterprise application , without writing own distributed and complex code, you can just concentrate on business logic and the EJB server handles all the complexities for you. which is very important for critical applications. EJB development and maintenance cost is very high ,so they are generally used for critical applications
there are number of good books as well as tutorials, you better spend some good time there 3. Anybody can help to implement MVC Architecture with J2EE technology ? yeah.... first you get your doubts clear about the above things there are different ways you can implement MVC I'm giving you a little example
let your Source Jsp is first.jsp, and the target is second.jsp
when you click a link on first.jsp , second.jsp should appear and should show a table of value fetched from the database
first.jsp will call ControllerServlet (passing the required information like nextPage,and task) controller Servlet will call Worker Servlet which in turn calls DataBean and get the required data.servlet will load this data in ViewBean and forward the request to Target JSP, which uses ViewBean and display the data in the table.... This is brief example...hope this is correct if you need help you can mail me at firstname.lastname@example.org hopt this helps