jsp第六次作业

1、

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body >
    <form action="login.jsp" method="post">
    用户名:<input type="text" name="uname" value="" />只能输入字母或数字 4-16个字符<br>
    密码:<input type="password" name="upwd" value="">密码长度6-12位 <br>
    确认密码:<input type="password" name="uwd" value=""><br>
    性别:<input type="radio" name="sex" value="boy"><input type="radio" name="sex" value="girl">女<br>
    电子邮件:<input type="text" name="email" value="">输入正确的Email地址<br>
    出生日期:<input type="text" name="nian" value="1999"><select name="date">
    <option value="05">05</option>
    <option value="06">06</option>    
    </select>
<select name="date1">
    <option value="05">05</option>
    <option value="06">06</option>    
    </select>
<br>
    <input type="submit" value="同意以下协仪条款提交"/><br>
    <textarea rows="4" cols="">什么也没有</textarea>    
    </form>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body>
    您注册的信息如下:<br>
    <%
    String uname = request.getParameter("uname");    
    String upwd = request.getParameter("upwd");
    String uwd = request.getParameter("uwd");
    String sex = request.getParameter("sex");
    request.setCharacterEncoding("utf-8");
    String email = request.getParameter("email");
    String nian = request.getParameter("nian");
    String date = request.getParameter("date");
    String date1 = request.getParameter("date1");
     %>
     
     用户名为<%=uname %><br>
     密码为<%=upwd %><br>
     性别为<%=sex %><br>
     电子邮件地址为<%=email %><br>
     出生日期为<%=nian %>年<%=date %>月<%=date1 %>日<br>
    
    
    
  </body>
</html>

 

 

2.

 

 

<%@ 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>
   
   <form action="average.jsp" method="post" >
        姓名:<input type="text" name="uname" /><br>
        性别:<input type="radio" name="sex" value ="男"/> 男
         <input type="radio" name="sex" value ="女"/> 女<br>
        班级:<select name = "bj">
        <option value="计算机1901">计算机1901</option>
        <option value="计算机1902">计算机1902</option>
        </select><br>
        数学:<input  type="text"  name="math" /><br>
        语文:<input  type="text"  name="chinese" /><br>
        英语:<input  type="text"  name="english" /><br>
        <input type="submit" value="提交"/>
        <input type="reset" value="重置"/>
        </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>

 

 

 

posted @ 2022-04-10 13:53  cccccccU-  阅读(3)  评论(0编辑  收藏  举报