表单注册(html+css+jsp)

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/pangqiandou/article/details/52831219

  

  1:html 注册表单并提交

<!DOCTYPE html>
<html>
  <head>
    <title>统一站点风格</title>
    <meta name="content-type" content="text/html; charset=UTF-8">
   <link rel="stylesheet" type="text/css" href="mycss.css">
  </head>
  
  <body>
   <form action="show.jsp">
    <table align="center">
    <tr>
      <td>用户名:</td>
      <td><input type="text" name="name"/></td>
    </tr>
    <tr>
      <td>密&nbsp;码</td>
      <td><input type="password" name="pwd"/></td>
    </tr>
    <tr>
      <td>确认密码:</td>
      <td><input type="password" name="pwdl"/></td>
    </tr>
    <tr>
      <td>性别:</td>
      <td> <input type="radio" name="sex" value="男"/>男&nbsp;
           <input type="radio" name="sex" value="女"/>女
       </td>
    </tr>
    <tr>
      <td>年龄:</td>
      <td><input type="text" name="age"/></td>
    </tr>
    <tr>
     <td>Email:</td>
     <td><input type="email" name="email"></td>
    </tr>
    <tr>
    <td colspan="2">
    <input class="button1" type="submit" value="注册">&nbsp;
    <input class="button1" type="reset" value="重置"></td>
    </tr>
    </table>
   </form>
   
  </body>
</html>

   2:css 样式修饰

body
{
margin:2em;
background-color:#CCCCFF;
}
td
{
font-family:"Time New Roman",Times,serif;
font-size:14px;
   font-weight:bold;
}
input 
{
font-size:9pt;
color:#003399;
font-family:宋体;
border:'1px' 'dashed' '#999999';
background:#EEEEEE;
}
.td1
{
font-size:12pt;
font-family:黑体;
}
.botton1
{
background:#FFFFFF;
font-weight:bold;
width:50px;
}

  3:表单显示

<%@ page contentType="text/html; charset=UTF-8" import="java.util.*"
language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML >
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String username = request.getParameter("name");
String password = request.getParameter("pwd");
String sex=request.getParameter("sex");
String age=request.getParameter("age");
String email=request.getParameter("email");
%>
<table border="1" align="center">
 <tr>
   <td>用户名:</td>
   <td><%=username%></td>
 </tr>
  <tr>
   <td>密码:</td>
   <td><%=password%></td>
 </tr>
  <tr>
   <td>性别:</td>
   <td><%=sex%></td>
 </tr>
  <tr>
   <td>年龄:</td>
   <td><%=age%></td>
 </tr> <tr>
   <td>邮箱:</td>
   <td><%=email%></td>
 </tr>
</table>
</body>
</html>

展开阅读全文

没有更多推荐了,返回首页