Hi, Practically there is nothing that you can achieve more in coding terms if you use JSP instead of servlets. The main advantage of JSP over servlets is that JSP separates the presentation code (HTML code) from the Java Code. It is tedious to use the out.println() statements in the servlet for each line of generated HTML code. Also it is difficult to change/debug a servlet as the HTML code is integrated with the java code. By implementing JSP you can make the HTML code generation a separate process and the Java Code generation a separate process. To incude ti business Logic you can also use JavaBeans which could connect to the EJB's. So there is complete demarcation between HTML Presentation code, HTTP Request/Response Code (JSP code) and the Business Logic (JavaBeans/EJB code). Well the minor and not so important advantage that servlets have over JSP's is that since JSP's have to be converted to a Servlet upon their first request to the server and the Servlet code has to be compiled and loaded into the servlet Engine. The first response time of a JSP is slower than a servlet, but upon subsequent requests the response times are the same. (This is a minor point as practically a developer always tests the JSP and has made the intitial request before making it available to other client requests commercially)
Hope this helps Sagar
Joined: Nov 28, 2000
Hi Sagar, Thanks for the reply. But, i was not looking at a comparison between JSP and Servlets. What i wanted was the drawbacks in Servlets (& indirectly JSP) in terms of coding, design and performance issues. I am not looking at any specific comparisons as such.
Drawbacks with respect to what? For my money, servlets are the MOST elegant way to create web services. You get excellent object orientation, clean threading, rapid development and excellent error handling. Although Perl fanatics will bitch about speed, servlets can also be quite fast if you follow some simple optimization rules. What's not to like? Valid complaints can be made about the number of print statements it takes to make complex HTML, but there is JSP and other solutions for that kind of application. Bill