输出注册信息javabean
输出用户注册信息:
package com.hanqi.test; public class UserInfo { private String name; private String password1; private String password2; private String email; private String phonenum; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword1() { return password1; } public void setPassword1(String password1) { this.password1 = password1; } public String getPassword2() { return password2; } public void setPassword2(String password2) { this.password2 = password2; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhonenum() { return phonenum; } public void setPhonenum(String phonenum) { this.phonenum = phonenum; } }
注册界面:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.hanqi.test.UserInfo"%> <!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="JBzhuce1.jsp" method="post"> <table width="300"> <tr> <td width="200">请输入昵称:</td> <td><input type="text" name="name"/></td> </tr> <tr> <td width="200">请输入密码:</td> <td><input type="password" name="password1"/></td> </tr> <tr> <td width="200">请确认密码:</td> <td><input type="password" name="password2"/></td> </tr> <tr> <td width="200">请输入邮箱:</td> <td><input type="text" name="email"/></td> </tr> <tr> <td width="200">请输入手机号码:</td> <td><input type="text" name="phonenum"/></td> </tr> <tr> <td width="150"><input type="submit" value="提交"/></td> <td><input type="reset" value="重置"/></td> </tr> </table> </form> </body> </html>
输出信息:
<%@page import="com.hanqi.test.UserInfo"%> <%@ 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> <% UserInfo ui=new UserInfo(); ui.setName(request.getParameter("name")); ui.setPassword1(request.getParameter("password1")); ui.setEmail(request.getParameter("email")); ui.setPhonenum(request.getParameter("phonenum")); out.print("姓名"+ui.getName()+"<br>密码:"+ui.getPassword1()+"<br>邮箱:"+ui.getEmail()+"<br>手机号:"+ui.getPhonenum()); %> </body> </html>
运行结果: