ajax( JavaScript和XML )

前端之家收集整理的这篇文章主要介绍了ajax( JavaScript和XML )前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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","CYR"}; 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,IOException { doGet(request,response); } }

原文链接:https://www.f2er.com/ajax/164917.html

猜你在找的Ajax相关文章