项目目录结构(注意:page下面的login和page同一级目录的index.jsp)
我这里测试的是:用index.jsp和login.jsp实现登录关于web.xml中servlet路径怎么配置?
测试一:用index.jsp实现登录
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!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=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="LoginServlet" method="post">
用户名:<input type="text" name="username" value=""><br/>
密码: <input type="text" name="password" value=""><br/>
<input type="submit" value="登录"><br/>
</form>
</body>
</html>
web.xml中配置
<?xml version="1.0" encoding="UTF-