第六周上机

一、

<%@ 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="login.jsp" method="post" >
    	用户名:<input type="text" name="uname" minlength="4" maxlength="16"/>只能输入字母或数字,4-16个字符<br>
    	密码:<input type="password" name="pas1" minlength="6" maxlength="12"/>密码长度6-12位<br>
    	密码:<input type="password" name="pas2" minlength="6" maxlength="12"/><br>
    	性别:<input type="radio" name="sex" value ="男"/> 男
    	 <input type="radio" name="sex" value ="女"/> 女<br>
    	 电子邮件地址:	<input type="email" name="em" value="1149575305@qq.com" />输入正确的Email地址<br>
    	 出生日期<input type="date" name="bir" value="1999年-02月-05日" /><br>
    	<input type="submit" value="同意协议条款并提交"/> <br>
    	<textarea name="bz" rows="5" cols="50">--这个家伙很懒,什么也没有留下--</textarea>
    	</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 password1=request.getParameter("pas1");
   			String password2=request.getParameter("pas2");
   			String sex=request.getParameter("sex");
   			String em=request.getParameter("em");
   			String bir=request.getParameter("bir");
   			
   			if(password1.equals(password2)){
   				out.print("注册成功");
   				out.print("用户名是:"+uname+"</br>"+"密码是:"+password1+"</br>"
   				+"性别是:"+sex+"</br>"+"电子邮件是:"+em+"</br>"+"出生日期是:"+bir+"</br>");
   			}
   			else{
   				out.print("两次密码不一样!");
   			}
   		 %>
  </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>
  
   <form action="arg.jsp" method="post" >
   		求平均值:</br>
    	姓名:<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>
    	<option value="计算机1903">计算机1903</option>
    	</select><br>
    	数学:<input  type="number"  name="math" /></br>
    	语文:<input  type="number"  name="chinese" /></br>
    	英语:<input  type="number"  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-06 10:06  倪楠  阅读(51)  评论(0编辑  收藏  举报