<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<head>
<title>第一个jsp</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form name="login" action="welcome.jsp" method="post">
<table>
<tr>
<td>
用户名:
</td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="确定"></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
<title>欢迎</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
欢迎你:
<%= request.getParameter("username") %>
</body>
</html>
制作了两个jsp页面,一个登录页面,一个欢迎页面。
碰到的问题:
1、首先是页面乱码
解决方案:<%@ page ContentType="text/html;charset=UTF-8"%>
2、request是jsp的一个内置对象。