Java
  Home arrow Java arrow Page 2 - Overview of Java Web Technologies, Par...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Overview of Java Web Technologies, Part 1
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2004-03-01

    Table of Contents:
  • Overview of Java Web Technologies, Part 1
  • Methods
  • Creating a Servlet Directory Structure
  • Reviewing Deployment Descriptors
  • Servlet Mapping
  • Defining Context Parameters
  • Retrieving Context Parameters
  • Listening to Application Events
  • Packaging and Deploying a Web Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Overview of Java Web Technologies, Part 1 - Methods


    (Page 2 of 9 )

    The init Method

    The init method is called the first time the servlet is invoked. It is called exactly once to indicate to the servlet that the servlet is being placed into service. You override this method to write initialization code that needs to be executed only once, such as initializing values, loading database drivers, and so on.

    The following is the method’s signature:

    public void init(ServletConfig config) throws ServletException

    The service Method

    The service method is called by the servlet container each time the servlet is invoked. For each incoming HTTP request, the servlet container creates a request object (that implements javax.servlet.ServletRequest or javax.servlet.http.HttpServletRequest) and a response object (that implements javax.servlet.ServletResponse or javax.servlet.http.HttpServletResponse) and passes both objects to the servlet’s service method. The request object encapsulates information parsed from the HTTP request that the servlet can use, such as the request URI, request headers and cookies, and request parameters. The servlet uses the response object to send responses to the Web client.

    The service method has the following signature:

    public void service(ServletRequest request, ServletResponse response)throws ServletException, java.io.IOException

    TIP: If you’re interested in knowing how a servlet container creates request and response objects, or how it works in general, read How Tomcat Works, available from www.brainysoftware.com.

    The destroy Method

    The servlet container calls the destroy method before removing a servlet instance from service. This normally happens when the servlet container is shut down or the servlet container needs some free memory. You use this method to clean up any resources (such as memory, file handles, and threads) that are being held and make sure that any persistent state is synchronized with the servlet’s current state in memory. The following is the destroy method’s signature:

    public void destroy()

    Buy this book now!Remember: This is part one of the first chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for part 2 of "Overviews of Java Web Technologies," where we learn about JSP, JavaBeans, and Model 2. 
    Buy this book!

    More Java Articles
    More By McGraw-Hill/Osborne


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway