日期:2014-05-17 浏览次数:20751 次
<servlet>
<servlet-name>LoginConf</servlet-name>
<servlet-class>LoginConf</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginConf</servlet-name>
<url-pattern>/LoginConf</url-pattern>
</servlet-mapping>
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户登录</title>
</head>
<body>
<h2>用户登录</h2>
<form action="LoginConf" method="post">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="uname" /></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="password" />
</tr>
<tr>
<td colspan="2">
<input type="submit" value="登录"/>
<input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class LoginConf
*/
@WebServlet(description = "登录检测", urlPatterns = { "/LoginConf" })
public class LoginConf extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequ