jsp第四次作业
<%@ page import="java.util.Date" %><% Date date; %><%-- Created by IntelliJ IDEA. User: 11512 Date: 2022/3/5 Time: 15:52 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <head> <title></title> </head> <body > <form action="doreg.jsp" method="post"> 用户名:<input type="text" name="uname" minlength="4" maxlength="16"> 只能输入字母或者数字<br> 密码:<input type="password" name="upwd" minlength="6" maxlength="12">密码长6-12位<br> 密码:<input type="password" name="upwd" minlength="6" maxlength="12"><br> 性别: <input type="radio" name="sex" value="男">男 <input type="radio" name="sex" value="女">女<br> 电子邮件地址 :<input type="text" name="yx"> <br> 出生日期:<input type="text" name="nyear" > 年 <select name="nmonth"> <option value="1">1月</option> <option value="2">2月</option> <option value="3">3月</option> <option value="4">4月</option> <option value="5">5月</option> <option value="6">6月</option> <option value="7">7月</option> <option value="8">8月</option> <option value="9">9月</option> <option value="10">10月</option> <option value="11">11月</option> <option value="12">12月</option>月<br> <h2></h2> </select> <select name="nday"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option>日<br> </select> <br> <input type="submit" value="同意协议条款并提交"/><br> <textarea name="bz" rows="5" cols="50">第一题第一题第一题第一题第一题第一题第一题</textarea><br> <input type="submit" value="注册"> </form> </body> </html>
<%@ page import="java.util.Date" %><% Date date; %><%-- Created by IntelliJ IDEA. User: 11512 Date: 2022/3/5 Time: 15:52 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <head> <title></title> </head> <body > 注册成功<br> <% request.setCharacterEncoding("utf-8"); String uname=request.getParameter("uname"); String upwd=request.getParameter("upwd"); String sex=request.getParameter("sex"); String yx=request.getParameter("yx"); String nyear=request.getParameter("nyear"); String nmonth=request.getParameter("nmonth"); String nday=request.getParameter("nday"); %> 你注册的用户名是:<%=uname %><br> 密码是:<%=upwd %><br> 性别是:<%=sex %><br> 邮箱是:<%=yx %><br> 出生日期是:<%=nyear %>年 <%=nmonth %>月 <%=nday %>日<br> </body> </html>
2.
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); %> <head> </head> <body> <form action="domarch.jsp" method="post"> <p>求平均值</p> 姓名:<input type="text" name="name"/><br> 性别:<input type="radio" name="sex" value="男"/>男 <input type="radio" name="sex" value="女"/>女<br> 班级:<select name="grade"> <option>101班</option> <option>102班</option> </select><br> 语文: <input type="text" name="chinese"/><br> 数学: <input type="text" name="math"/><br> 英语: <input type="text" name="english"/><br> <input type="submit" name="提交"> <input type="reset" name="重置"> </form> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <% String uname=request.getParameter("uname"); String sex=request.getParameter("sex"); String bj=request.getParameter("bj"); String bir=request.getParameter("bir"); String math=request.getParameter("math"); String chinese=request.getParameter("chinese"); String english=request.getParameter("english"); double a=Double.parseDouble(math); double b=Double.parseDouble(chinese); double c=Double.parseDouble(english); double arg=(a+b+c)/3; out.print("你好!"+bj+"的"+uname+"同学!"+"</br>"+"性别:"+sex+"</br>"+ "您的各科平均分数是:"+arg); %> </body> </html>