Tuesday, 30 August 2011

GetParameters Servlets Program

//GetParameters Servlets Program
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class GetParameter extends HttpServlet
{
      public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException, ServletException
    {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();   
            String firstName = request.getParameter("firstname");
            String middleName = request.getParameter("middlename");
            String lastName = request.getParameter("lastname");
   
            out.println("<b><font color='blue'>Your FirstName is : </font></b>"  
                              + "<b>"+ firstName +"</b>" + "<br>");
            out.println("<b><font color='blue'>Your Middle Name is : </font></b>" 
                              + "<b>"+ middleName +"</b>" + "<br>");
            out.println("<b><font color='blue'>Your Last Name is : </font></b>" 
                              + "<b>"+ lastName +"</b>");
      }
}

No comments:

Post a Comment