package com.neusoft.sms.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 RegServlet extends HttpServlet {
public boolean isExist(String username){
String[] names={"jack","rose","marry","lpz"};
for (String s : names) {
if(username.equalsIgnoreCase(s)){
return true;
}
}
return false;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
response.setContentType("text/html;charset=gbk");
PrintWriter out = response.getWriter();
String username=request.getParameter("uname");
boolean flag=isExist(username);
out.println(flag);
out.flush();
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}