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.
1) Servlets and JSPs provide the API to react on HTTP requests. You could of course write your own HTTP server and a custom API but what's the sense there? The wheel's not round enough for you...? In other words, servlets and JSPs (which are compiled into servlets) are the entrypoint between raw HTTP protocol and your application logic.
2) JSP "should" be used for generating the answer or output of the received HTTP request. Keeping that in mind, the Java code within a JSP should be directly related to generating HTML/WML/XML etc.
Using a MVC framework like Struts can help you to start
/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Hi Dharmin, Which technology to use usually depends on the creation process and the number of people involved. If you're doing a little site yourself and you're going to do all the visual and business logic yourself then you could easily use JSP's for the basic look of the site and call servlets for form processing, for example. If you are part of a team in an ongoing project where static data is changins and the visual part of the site will be done by a specialist team of web desingers ( who don't know java ) then perhaps JSP's with beans and custom tags would help control the project better - and keep the web design people away from your code! There are many other perfectly valid combinations which can be used but the main point I want to make is that it's the technology that should fit the project and not vice versa. Hope this helps, Terry
Hi Dharmin, you could use servlet to control access to other resources like EJBs or to decide which objects should process which request. The servlet could use a JSP to display data obtained from a data source through an EJB. JSPs are mostly used to generate dynamic web content, and Servlets are used for business logic. You might still ask me if servlets can be used for business logic, why EJBs? - you may use them when your application serves multiple clients like web browsers, Swing
- your application needs to support concurrent access, transaction management, needs to be highly scalable, manage method level security for several users of the system, persistence management. Ebage SCJP SCEA