📄 requestdemo1.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.util.*" %>
<html>
<head>
<title>
接收请求参数
</title>
</head>
<body bgcolor="#ffffff">
<h1>
接收客户端请求数据
</h1>
<%
//request.setCharacterEncoding("GBK");
String name=request.getParameter("name");
String sex=request.getParameter("sex");
String[] interest=request.getParameterValues("interest");
//对GET请求的额外处理
name=new String(name.getBytes("ISO-8859-1"),"GBK");
sex=new String(sex.getBytes("ISO-8859-1"),"GBK");
for (int i = 0; i < interest.length; i++) {
interest[i]=new String(interest[i].getBytes("ISO-8859-1"),"GBK");
}
%>
<table border="1">
<tr>
<td>用户名:</td>
<td><%=name%></td>
</tr>
<tr>
<td>性别:</td>
<td><%=sex%></td>
</tr>
<tr>
<td>兴趣爱好:</td>
<td>
<%
for (int i = 0; i < interest.length; i++) {
out.print(interest[i]);
out.print(",");
}
%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -