1.jsp
?1?<%@page?contentType="text/html;charset=GB2312"?%>
?2?<%
?3??????request.setCharacterEncoding("GB2312");
?4?%>
?5?
?6?<html>
?7???<head>
?8?????<title>1.jsp</title>
?9???</head>
10???
11???<body>
12???????<%?????????
13???????????String?Name=request.getParameter("name");
14???????%>
15???????<h1>內容:<%=Name?%></h1>
16???</body>
17?</html>
直接在地址欄輸入:http://localhost/web/request/1.jsp?name=zxm?2?<%
?3??????request.setCharacterEncoding("GB2312");
?4?%>
?5?
?6?<html>
?7???<head>
?8?????<title>1.jsp</title>
?9???</head>
10???
11???<body>
12???????<%?????????
13???????????String?Name=request.getParameter("name");
14???????%>
15???????<h1>內容:<%=Name?%></h1>
16???</body>
17?</html>
就可以顯示結果。
如果傳遞多個參數,可以這樣輸入地址:localhost/web/request/1.jsp?name=zxm&password=123