aspose file tools*
The moose likes Servlets and the fly likes Disadvantages of Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Disadvantages of Servlets" Watch "Disadvantages of Servlets" New topic
Author

Disadvantages of Servlets

madhesh raj
Ranch Hand

Joined: Nov 28, 2000
Posts: 62
Hi,
Like most people i was ga-ga over JSP & Servlets. But, i was taken aback when someone asked me to list the disadvantages of Servlets & JSP. Can someone help me on this issue?
Regards
Madhesh
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
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
madhesh raj
Ranch Hand

Joined: Nov 28, 2000
Posts: 62
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.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
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

------------------
author of:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disadvantages of Servlets