第六周

1

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form action="index.jsp" method="post">
<table width="500px" border="0" cellspacing="10" cellpadding="10">
<tr><th>注册</th><th> </th></tr>
<tr><td>用户名</td><td>

<input name="username" placeholder="输入用户名" />
</td></tr>

<tr>
<td> 密码 </td>
<td>
<input type="password" name="logpwd" maxlength="18" placeholder="请输入密码" />
</td>
</tr>
<tr>
<td> 确认密码 </td>
<td>
<input type="password" name="logpwd1" placeholder="请再次输入密码"/>
</td>
</tr>

<tr>
<td> 性别</td>
<td>
<input type="radio" name="gender" value="男" checked />男
<input type="radio" name="gender" value="女" />女
</td>
</tr>
<tr>
<td> EMaile</td>
<td>
<input type="email" name="mail" value="657487560@qq.com" />
</td>
</tr>
<tr>
<td> 出生日期 </td>
<td>
<input type="date" name="hiredate" value="1999-10-18" />
</td>
</tr>
<tr><td>
<input type="submit" value="登录协议调款并登录" />
</td></tr>
<tr>
<td> 协议</td>
<td>
<textarea rows="5px" cols="50px">aaaaaaaaa</textarea>
</td></tr>
</table>
</form>
</body>
</html>

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%
request.setCharacterEncoding("utf-8");

%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
您注册的用户信息如下
<%
out.println(request.getParameter("username"));
out.println(request.getParameter("logpwd"));
out.println(request.getParameter("gender"));
out.println(request.getParameter("mail"));
out.println(request.getParameter("hiredate"));
%>
</body>
</html>

 

 2

<%@ 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="index.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">1732301</option>
<option value="2">1732302</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 15:35  刘德璞  阅读(24)  评论(0编辑  收藏  举报