第六周作业

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>
    <base href="<%=basePath%>">
    
    <title></title>

  </head>
  
  <body>
      <form action="MyJsp.jsp" method="post">
    用户名:<input type="text" name="uname" value="" /><br>
    密码:<input type="password" name="upwd" value=""> <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=""><br>
    出生日期:<input type="text" name="nian" value="1999"><select name="date">
    <option value="02">02</option>
    <option value="03">03</option>    
    </select><select name="date1">
    <option value="02">02</option>
    <option value="03">03</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>
    <base href="<%=basePath%>">
    
    <title></title>
  

  </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>

 

 

 

 

任务二.png

<%@ 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>
    <base href="<%=basePath%>">
    
    <title></title>

  </head>
  
  <body>
     <form action="MyJsp.jsp" method="post">
    求平均值:<br>
    姓名:<input type="text" name="name" value="name"><br>
    性别:<input type="radio" name="sex" checked="checked" value="boy"><input type="radio" name="sex" value="girl"><br>
    班级:<select name="class">
    <option value="1">1932301</option>
    <option value="2">1932302</option>
    </select><br>
    语文:<input type="text" name="yu" ><br>
    数学:<input type="text" name="shu" ><br>
    英语:<input type="text" name="ying" ><br>
    <input type="submit" value="提交" >
    <input type="reset" value="重置">
    </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>
    <base href="<%=basePath%>">
    
    <title></title>
  

  </head>
  
  <body>
   <%
    request.setCharacterEncoding("utf-8");
    String name=request.getParameter("name");
    String sex=request.getParameter("sex");
    String clas=request.getParameter("class");
    String yu=request.getParameter("yu");
    String shu=request.getParameter("shu");
    String ying=request.getParameter("ying");
     double a=Integer.parseInt(yu);
     double b=Integer.parseInt(shu);
     double c=Integer.parseInt(ying);
     double d=(a+b+c)/3;
     %>
     你好!<%=clas%>班的<%=name %>同学!<br>
     性别:<%=sex %><br>
     您各科平均分是:<%=d %>
  </body>
</html>

 

 

 

posted @ 2022-04-09 17:03  假̶装̶乐̶观̶♡̶  阅读(4)  评论(0编辑  收藏  举报