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
SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
hi you can do everything using JSP what ever u can do with servlets.but coming to servlets, u have to combine both HTML and java code which is tedious when the HTMl code is huge.In this situation using JSP is very comfortable, as jsp seperates presentation logic and business logic. The same java code will work both in servlets and JSP's.It's always good to use the combination of servlets and JSP. coming to MVC architecture--> use EJB's as model and JSP as View(presentation part)and servlets as controller
wouldnt it be a lot of work writing a servlet to display a page when the only java code needed is this: request.getParameter("name")? jsp also has the advantage that you dont have to recompile and then restart the server to make changes.
JSP decouples presentation from logic. So any page change is simpler. servlets should be used for business logics or can be Front controller or can be just a controller. JavaBeans can be reusable data components. EJB can be used to implement Value Object pattern. Just read J2EE design patterns that will help you understand the role of each of these.
Jagdeep Singh<br />SCJP;SCWCD;IBM Certified XML Solution Developer;SCBCD1.3
posted 16 years ago
Thanks friends, Actually, i need to do some more homework !
But please remember that JSP is not the only page-building technology. A templating approach (such as WebMacro or Velocity) offers the same benefits of separating presentation from logic, without the hideous JSP syntax and the irritating compilation step on the deployment box. And the powerful expression language built into either WebMacro or Velocity is miles ahead of the first clumsy steps in the JSP Standard Tag Library. Similarly, EJB is not the only option for persistence of data. Fundamentally EJB is just an object-relational mapping system, and there are several of those to choose from. Decoupling details of the storage mechanism from the object model is usually a good choice, but you don't always need EJB to achieve it.