<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
<head><title>首页</title></head>
<body>
<h1>用户登录</h1>
<form methord="post" action="index.jsp">
用户名<input name="username" type="text" >
密码<input name="password" type="password" >
<input type="submit" value="登录">
<input type="reset" value="重置">
</form>
</body>
</html>
<html>
<head>
title>登陆后的显示 </title>
</head>
<h2>登录成功</h2>
<jsp:useBean id="user" scope="request" class="demo"></jsp:useBean>
<jsp:setProperty property="*" name="user" />
用户名: <%=user.getUsername() %>
密码:<%=user.getPassword() %>
</head>
<body>
</body>
</html>
public class demo {
private String username;
private String password;
public demo() {
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/2020092217441491.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1Njc4MjI0,size_16,color_FFFFFF,t_70#pic_cent