<%-- Document : form Created on : 2020-4-11, 23:10:56 Author : Administrator --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> 收集参数的表单页 </title> </head> <body> <form id="form1" method="get" action="request2.jsp"> 用户名:<br/> <input type="text" name="name"><hr/> 性别:<br/> 男:<input type="radio" name="gender" value="男"> 女:<input type="radio" name="gender" value="女"><hr/> 喜欢的颜色:<br/> 红:<input type="checkbox" name="color" value="红"> 绿:<input type="checkbox" name="color" value="绿"> 蓝:<input type="checkbox" name="color"value = "blue" > < HR /> from the country: < br /> < the SELECT name = "Country" > < the Option value = "China" > China </ the Option > < the Option value = "United States" > United States </ option > < option value = "Russia" > Russia </ option > </ select > < hr /> <input type="submit" value="提交"> <input type="reset" value="重置"> </form> </body> </html>
<%-- Document : request2 Created on : 2020-4-11, 23:28:51 Author : Administrator --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> < title > Get GET request parameters </ title > </ head > < body > <% // Get the value of the name request parameter String name = request.getParameter ( " name " ); // Get the value of the gender request parameter String gender = request.getParameter ( " gender " ); %> <!- output name variable value- > your name: <% = name %> <hr/> <!- Output gender variable value- > Your gender: <% = gender %> < hr /> </ body > </ html >