servlet

understanding JSP life cycle

The JSP life cycle: JSP life cycle is defined by JspPage and HttpJspPage interfaces. Similar to servlet, JSP life cycle has three methods: jspInit(), jspDestroy() and _jspService() . javax.servlet.jsp package contains classes and interface of JSP API. Main classes and interfaces of the JSP API are: JspPage: It extends Servlet interface and provides following JSP […]


Introduction to JSP

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 […]



Practical use of @WebServlet and other annotations

To demonstrate the practical use of servlet annotations, I have created a web application which have two servlets (ProcessingServlet & ForwardingServlet), a listener (HitCounterListener), a filter (HitCounterFilter) and a HTML page (index.html). When the application is deployed, HitCounterListener sets an attribute named hitCount in the application scope to count the no. of hits of the […]