jsp简单注册页面

register.html

<!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=GBK">
<title>用户注册</title>
</head>
<body>
<center>
<form action="register_check.jsp" method="post">
用户名:<input type ="text" name="name"><br>
密码:<input type ="password" name="password"><br>
性别:<input type="radio" name="sex" value="男">男
<input type="radio" name="sex" value="女">女
<br>
爱好:<input type="checkbox" name="like" value="体育">体育
<input type="checkbox" name="like" value="音乐">音乐
<input type="checkbox" name="like" value="美术">美术
<br>
国家:<select name="country">
<option value="中国" selected>中国</option>
<option value="美国" selected>美国</option>
<option value="英国" selected>英国</option>
</select>
<br>
备注:<textarea name="beizhu" cols="20" rows="3"></textarea>
<br>
<input type="submit" value="提交"><input type="reset" value="重填">
</form>
</center>
</body>
</html>


register_check.jsp

<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!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=GB18030">
<title>注册处理页面</title>
</head>
<body>
<h1>使用脚本段代码处理注册信息</h1>
<%
request.setCharacterEncoding("GBK");
String name= request.getParameter("name");
String password = request.getParameter("password");
String sex=request.getParameter("sex");
String[] likes=request.getParameterValues("like");
String country = request.getParameter("country");
String beizhu=request.getParameter("beizhu");

%>
<h1>打印出注册信息<br>
姓名:<%=name %><br>
密码:<%=password %><br>
性别:<%=sex %><br>
爱好:<%for(int i=0;i<likes.length;i++){
String like=likes[i];
%>
<%=like %>
<% } %><br>
国家:<%=country %><br>
备注:<%=beizhu %><br>
</h1>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值