1.今天学习
编写 UserBean
package come.hanqi.test; public class YhBean { private String username; private String password; private String email; private String dizhi; 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; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getDizhi() { return dizhi; } public void setDizhi(String dizhi) { this.dizhi = dizhi; } }
<%@ 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="testYhBean2.jsp" method="post"> <table align="center" width="400" height="200" border="1"cellspacing="0" cellpadding="0"> <tr><td align="center" height="50" colspan="2">请输入注册信息</td></tr> <tr> <td>账号:</td> <td><input type="text" name="username"></td> </tr> <tr> <td>密码:</td> <td><input type="password" name="password"></td> </tr> <tr> <td>邮箱:</td> <td><input type="text" name="email"></td> </tr> <tr> <td>地址:</td> <td><input type="text" name="dizhi"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" value="提交"></td> </tr> </table> </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");%> <jsp:useBean id="person" class="come.hanqi.test.YhBean"> <jsp:setProperty name="person" property="*"/></jsp:useBean> 您的注册信息为:<br> 账号:<jsp:getProperty property="username" name="person"/><br> 密码:<jsp:getProperty property="password" name="person"/><br> 邮箱:<jsp:getProperty property="email" name="person"/><br> 地址:<jsp:getProperty property="dizhi" name="person"/><br> </body> </html>
2.没有遇到问题
3.明天打算学习
编写 userlist.jsp