Submitted by heartin on Fri, 03/20/2015 - 11:37
Filters are pluggable classes that stand between the client and a target component (like a servlet or JSP), within a web application. We can do pre or post processing of request/response data while it is coming from client to a servlet or from the servlet back to a client. Before filters were introduced in Java EE, we had to use servlets with RequestDispatcher to achieve pre or post processing of request/response data. Filters add a lot of flexibility over servlet for such extra processing which is not directly involved in response creation.
Submitted by heartin on Sat, 03/07/2015 - 11:36
Listeners are classes that will wait for certain life cycle events and the container will invoke certain methods of these classes when that life cycle event happens. There will be listener interfaces, with methods that need to be invoked when a life cycle event occur. The listener implementation class will need to implement this interface.
You can specify a listener in either of the ways:
Submitted by heartin on Sun, 04/13/2014 - 03:28
We will see how to write to a file in file system from a servlet. To write to a file in the root folder of a web app, we will need the real path to it. Using the path we can write to the file. Note that the WeContent folder you see in eclipse during development becomes the root folder of the web app, as we archive the contents of the WebContent folder to create a war file.
Submitted by heartin on Fri, 04/11/2014 - 22:04
Parameters may come into our application from the client request, or may be configured through deployment descriptor (web.xml) elements or their corresponding annotations. When you submit a form, form values are sent as request parameters to a web application. In case of a GET request, these parameters are exposed in the URL as name value pairs and in case of POST, parameters are sent within the body of the request.
Submitted by heartin on Thu, 04/10/2014 - 10:32
Java servlets are Java’s technology for developing dynamic web applications. Technically, servlets are java classes that conform to the Java Servlet API. Servlet API allows java classes to respond to different types of requests; however, the most popular is HTTP requests.