package Servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Getinit extends HttpServlet {
private String logname;
private String password;
public String getLogname() {
return logname;
}
public void setLogname(String logname) {
this.logname = logname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Getinit() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println("<h2>"+"用户名;"+this.getLogname()+"</h2>");
out.println("<h2>"+"密码:"+this.getPassword()+"</h2>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
public void init() throws ServletException {
this.setLogname(this.getInitParameter("logname"));
this.setPassword(this.getInitParameter("password"));
}
}