81,090
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>获取客户提交的信息案例</title>
</head>
<body>
<div class="zjfclass" align="center">
<form action="ex8-02.jsp" method="post">
<table>
<tr>
<td>
姓名:
</td>
<td>
<input name="name" />
</td>
</tr>
<tr>
<td>
电话:
</td>
<td>
<input name="phone" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="submit" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>request对象常用方法应用案例</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
out.println("姓名文本框提交信息:" + request.getParameter("name") + "<br />");
out.println("电话文本框提交信息:" + request.getParameter("phone") + "<br />");
out.println("客户端协议名和版本号:" + request.getProtocol() + "<br />");
out.println("客户机名:" + request.getRemoteHost() + "<br />");
out.println("客户机的IP地址:" + request.getRemoteAddr() + "<br />");
out.println("客户提交信息的长度:" + request.getContentLength() + "<br />");
out.println("客户提交信息的方式:" + request.getMethod() + "<br />");
out.println("HTTP头文件中的Host值:" + request.getHeader("Host") + "<br />");
out.println("服务器名:" + request.getServerName() + "<br />");
out.println("服务器端口号:" + request.getServerPort() + "<br />");
out.println("客户请求页面的文件目录:" + request.getServletPath() + "<br />");
%>
</body>
</html>