View RSS Feed


Servlet tutorials.

  1. General Event Handling in Servlets Part 3

    by , 11-29-2011 at 12:35 AM
    In the first two article on general event handling with servlets we have covered how to detect changes in the servlet context and monitoring the creation and destruction of the servlet context. In this last article of the series we will look into how to use listeners with tag libraries. If you have not seen the first two articles of this series, General Event Handling in Servlets, Part 1 and General Event Handling in Servlets, Part 2, then I would recommend that you review them before continuing ...

    Updated 12-09-2011 at 05:16 PM by Servlet

    ServletContextListener , Tutorial , Web , Listener
  2. General Event Handling in Servlets Part 2

    by , 11-29-2011 at 12:26 AM
    In the last article, we started to look into the Application Events Framework for servlets and javaserver pages. We listed eight different kinds of events listeners that are related to web application life-cycle events. If you are interested, go review the post, General Event Handling in Servlets Part 1.

    In that article, we looked at the first of the listeners for the initialization and destruction of servlet context and we presented an example of it’s use for a company that is constantly ...

    Updated 12-09-2011 at 05:13 PM by Servlet

    Tutorial , Web , Listener , ServletContextListener
  3. General Event Handling in Servlets Part 1

    by , 11-29-2011 at 12:15 AM
    When you are developing applications using servlets or JSP pages, there are a number of tools at your disposal for handling the life cycle of individual servlets or JSP pages. The servlet init method fires when a servlet is first instantiated. With JSP pages it is the jspInit method. Both methods can use initialization parameters that are specified with the init-param subelement of the web.xml servlet element. Requests are handled with service and _jspService, and destruction is handled with destroy ...

    Updated 11-30-2011 at 03:15 PM by Servlet

    Web , Listener , ServletContextListener , Tutorial
  4. Reading Request Headers from Servlets

    by , 11-28-2011 at 07:31 PM
    It is relatively easy to read headers. All you need to do is call the getHeader method of HttpServletRequest. If the specified header exists, the servlet returns a String, if not the servlet will return null. Unlike parameter names, header names are not case sensitive. Although getHeader is a general-purpose way to read incoming headers, there are a couple of headers that are so commonly used that they have special access methods in HttpServletRequest. They are listed below.
    • getCookies
  5. Notes on Form Data for Servlets

    by , 11-28-2011 at 07:25 PM
    When you look at the URL in your web browser if you are using a search engine or on a retail site, you will notice URLs http://host/path?user=James+Rogers&s...rish&sub=music. The part after the question mark (i.e., user=James+Rogers&subj= folk&sub=irish&sub=music) is known as form or query data and is the most common way to get information from a Web page to a server-side program. Form or query data can be attached to the end of the URL after a question mark, for ...
    Tutorial , HTTP , URL Mapping , Form
  6. Handling Form Data from Servlets

    by , 11-28-2011 at 07:23 PM
    A feature which is of immense benefits to all programmers working with servlets is that all form data parsing is handled automatically. Rather than needing to build your own called for parsing form data, you only need to call the getParameter method of the Http- ServletRequest, providing the relevant parameter name as an argument. You use getParameter in the same way whether data is sent by GET or by POST. The servlet knows which request method was used and calls the proper method to handle the ...
    Form , Tutorial
  7. How to Debug Servlets

    by , 11-28-2011 at 07:07 PM
    Servlets can be difficult to debug because it is not possible to execute them directly. Instead, you trigger their execution by means of an HTTP request, and they are executed by the Web server. For remote execution, inserting break points or reading debugging messages and the stack traces becomes extremely difficult. Here I will outline some strategies to servlet debugging:
    1. Check the HTML source. If it doesn’t look correct, use the “View Source” command in order to check the HTML. If
    Tutorial , HTTP