Servlet’s Life moment Listeners

Scenario  Listener interface  Event type  You want to know if an attribute in a web app context has been added, removed, or replaced. javax.servlet.ServletContextAttributeListener attributeAdded attributeRemoved attributeReplaced ServletContextAttributeEvent  You want to know how many concurrent users there are. In other words, you want to track the active sessions. (We cover sessions in detail in the ...

RequestDispatcher

A RequestDispatcher object can forward a client’s request to a resource or include the resource itself in the response back to the client. A resource can be another servlet, or an HTML file, or a JSP file, etc. You can also think of a RequestDispatcher object as a wrapper for the resource located at a given path ...

Invalid Statements

1. Using the method isUserInRole(), overrides any declarative authorization related to method in which it is invoked – isUserInRole() method itself doesn’t do any authorization. 2. name - value attribute is mandatory for  3. Benefits of the JSP precompilation is , it avoids initialization on the first request. 4.             java.lang.Error             /error.html           - valid value ...