Myeclipse登录系统验证

Myeclipse登录系统验证

JS代码

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>






My JSP 'index.jsp' starting page














		

csgo登录

账号:

密码:

Servlet

package Verify;

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 Installed extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();

		String name = "周海涛";
		String pwd = "123456";

		String ajaxName = request.getParameter("name");
		String ajaxPwd = request.getParameter("pwd");
		System.out.println(ajaxName + "——" + ajaxPwd);

		if (name.equals(ajaxName) && pwd.equals(ajaxPwd)) {
			out.print("ok");
		} else {
			out.print("error");
		}

		out.flush();
		out.close();
	}

}

Myeclipse登录系统验证_第1张图片

你可能感兴趣的:(Myeclipse登录系统验证)