import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class ContactsServletBean extends HttpServlet {

  // contact attributes
  private String company = new String("");
  private String street = new String("");
  private String city = new String("");
  private String state = new String("");
  private String zip = new String("");
  private String email = new String("");
  private String phone = new String("");
  private String fax = new String("");

  // Accessors that make this a Bean
  public void setCompany(String value) {

    if ( value != null ) {

      company = value;
    }
  }

  public String getCompany() {

    return company;
  }

  public void setEmail(String value) {

    if ( value != null ) {

      email = value;
    }
  }

  public String getEmail() {

    return email;
  }

  public void setFax(String value) {

    if ( value != null ) {

      fax = value;
    }
  }

  public String getFax() {

    return fax;
  }

  public void setPhone(String value) {

    if ( value != null ) {

      phone = value;
    }
  }

  public String getPhone() {

    return phone;
  }

  public void setStreet(String value) {

    if ( value != null ) {

      street = value;
    }
  }

  public String getStreet() {

    return street;
  }

  public void setCity(String value) {

    if ( value != null ) {

      city = value;
    }
  }

  public String getCity() {

    return city;
  }

  public void setState(String value) {

    if ( value != null ) {

      state = value;
    }
  }

  public String getState() {

    return state;
  }

  public void setZip(String value) {

    if ( value != null ) {

      zip = value;
    }
  }

  public String getZip() {

    return zip;
  }


  public void init(ServletConfig config)
    throws ServletException {

    super.init(config);
  }

  //Process the HTTP Get request
  public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {

    doPost(request, response);
  }
//Process the HTTP Post request
  
  public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();

    // HTML Output
    out.println("<CENTER>");

    // Use the bean accessors to get data
    out.println(getCompany() + "<BR>");
    out.println(getStreet() + "<BR>");
    out.println(getCity() + "," + getState() + " " + getZip()
      + "<BR>");
    out.println(getEmail() + "<BR>");
    out.println(getPhone() + "<BR>");
    out.println(getFax() + "<BR>");
    out.println("</CENTER>");
    
    out.close();
  }
}
