Limitations of servlet:
Servlet as web application development technology has following drawbacks:
1. Developing web applications using servlet is unproductive i.e. a lot of code need to written even for simple tasks.
2. A servlet is responsible for dynamic content generation as well as presentation. This intermixing of dynamic content generation logic with the presentation logic, creates maintenance problem. Each time presentation (HTML) is changed, Servlets need to be modified.
JSP and the automation of servlet:
Java Server Pages (JSP) is the extension of servlet which facilitate productive development of dynamic web applications in Java. JSP removes the above drawbacks of servlets by completely changing the web application development model. In a servlet, HTML is generated from the program whereas in JSP, request processing logic is written to the HTML with the help of special tags. Each JSP page is translated by the server into a servlet as described by the following diagram:
Description of the diagram:
Note:- If a JSP page is modified after translation then its servlet is regenerated when next request is sent for it.
Advantages of the JSP over servlet:
1. JSP increases the productivity of the application programmers as they are only required to provide the processing logic. All the repetitive tasks such as defining classes & request processing methods, and writing static HTML contents to the output stream, are automated.
2. Maintenance is simplified. Static HTML contents or request processing logic can be changed on the fly because of the automated translation.
If you have read all the posts of servlets and practised their concepts then you would have understood the above limitations of the servlet. You can now appreciate the ease of development offered by the JSP but for that you need to understand the relation of _jspService(request,response) method to the servlet. In servlet, there was no such method!
If you have noticed this method in the diagram and this question came to your mind as well then you are on the right track. You have developed the conceptual thinking. The next post, has the answer of your question.