Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

Servlet

April 5, 2000

A simple servlet can look like:

	
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


1. public class FirstServlet extends HttpServlet {

2.   public void doGet(
3.          HttpServletRequest request, HttpServletResponse response)
4.          throws ServletException, IOException {


5.   PrintWriter out = response.getWriter();
6.   out.println("The First Servlet Worked !");
     }
   }

Note: Line numbers in the above example are used for clarity and are not part of the syntax

Refer to appendix A to know more about compiling and executing Servlets and the HTML syntax.

If you 'link' to this servlet from your browser, it will come back to you with this message:

The First Servlet Worked !

Explanation of the code:

The first three import statements are pretty much standard .. to import the required classes.

Line 1: your Servlet should extend HTTPServlet to inherit the HTTP specific properties & methods.
Line 2: The HTTP Get request is passed to the doGet method (similarly the HTTP POST request is passed to doPost).
Line 3: defines the standard parameters passed to doGet & doPost methods.
Line 4: completes the signature of doGet.
Line 5 & 6 are self explanatory .. just print the stuff !

A Brief Introduction to Servlets and JSP
Building Web Applications Using Servlets and JSP
The Next Servlet: The Request and the Response


Up to => Home / Authoring / Java / Servlets




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers