What are JSP and Servlets, and how do they interact?
Serge Plourde
Ranch Hand
Joined: Jun 23, 2000
Posts: 140
posted
0
I still did not "touch" to these topics, but I am curious to learn a bit more about those: what they are and how they interact (if there is such interaction). So, please excuse my question if it sounds too simple! In addition to this, what are the best books available? Is there "free" stuff on the web to learn those?
[This message has been edited by Serge Plourde (edited April 24, 2001).]
David Freels
Ranch Hand
Joined: Feb 01, 2001
Posts: 102
posted
0
JSP - JavaServer Pages - HTML files with embedded Java code. JSP files get compiled into servlets upon receiving a request. Servlets are java files that basically replace CGI scripts. Servlets are loaded into memory and threaded for each request that is recieved. Both technologies require an engine to run in such as JRun or Tomcat. Further information can be obtained from http://www.javasoft.com/products/servlet/index.html and http://www.javasoft.com/products/jsp/index.html David Sun Certified Programmer for the Java2 Platform
Thanks, all of you. Those are all great suggestions and links!
Desai Sandeep
Ranch Hand
Joined: Apr 02, 2001
Posts: 1157
posted
0
Hi, JSP is designed to make the life of the programmer easier.Using servlets you can do lots and lots of complicated stuff, but you never tend to use all of them.If that is the case, JSP is the place where you should start from. By design JSP sits on the top of the servlets.What this means is when you write a JSP code and execute it the JSP Engine complies the JSP page as a servlet, and then makes the class file for it.After that the normal life cycle of the servlet, viz. init(), service() and destroy() follows. One more advantage of using JSP rather than Servlets, is that,it seperates static content from dynamic content.This means the HTML code can be designed in parallel with the dynamic code that is generated by the JSP tags.This allows Web developers to work in co-ordination with the Java Developers. Java Developer could make JavaBeans to be used by the Web Developers, who simply use it to generate the dynamic content.The inherent advantage you have with a JSP design is you seperate the business logic from the presentation logic making your page causing lesser maintenance problems. Hope this helps. Regards,