Servlet Java Tutorial

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class MyServlet extends HttpServlet {
   
 public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
        
        response.setContentType("text/html");
        java.io.PrintWriter out = response.getWriter();
        String contextPath = request.getContextPath();
        String encodedUrl =  response.encodeURL(contextPath + "/default.jsp");
       
        out.println("");
        out.println("");
        out.println("URL Rewriter");  
        out.println("");
        out.println("");
        out.println("

This page will use URL rewriting if necessary

");
        out.println("Go to the default.jsp page             "\">here.");
        out.println("");
        out.println("");
      
  } 
  
  public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
      doGet(request,response);
  
  }
}


    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

    MyServletName
             MyServlet
        
            
                go
            

            
                weather
            

        

             
    

    
    MyServletName
        /index.html