Skip to main content

skip to main content

developerWorks  >  Java technology  >

Revisiting Java technology on the client

Make use of the full spectrum of the Java platform to build compelling systems

developerWorks


Listing 2. Using a servlet to return a Java object


protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
{
  // code here to set content type and other information
  ObjectOutputStream ObjectOutput = new ObjectOutputStream(resp.getOutputStream);
  ObjectOutput.writeObject(GetShippingInformation(req.getParameter("ShippingPostalCode")));
    // GetShippingInformation calculates shipping and handling, and all tax rates for a given location
    // within the United States or Canada.  This is returned as a ShippingInformation object.
  // code here to clean up and handle exceptions.
}


Return to article