<%@ 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>登錄信息</title>
</head>
<body>
<form action="loginParamter.jsp"method="POST">
<p>用戶名:<input name="username" type="text"> </p>
<p>密 碼:<input name="password" type="password"> </p>
<p><input name="sumbit"type="submit"value="登錄"></p>
</form>
</body>
</html>
<%@ 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>獲取登錄參數</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String username = request.getParameter("username");
String password = request.getParameter("password");
out.println("用戶名:"+username);
out.println("密碼:"+password);
%>
</body>
</html>
使用jsp可以訪問webxml裏面的數據。jsp的內置對象實現了servlet的大部分功能。