我在“index.jsp”中创建了一个 html 表单编码,如下所示......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="StudentController.do" method="post">
Name:<input type="text" name="name"></br>
Id:<input type="text" name="id"></br>
Stream:<select name="stream">
<options value="UNKNOWN">select stream.....</options>
<options value="it">IT</options>
<options value="cs">CSC</options>
<options value="ece">ECE</options>
<options value="eee">EEE</options>
<options value="aerospace">AEROSPACE</options>
</select>>
Sex:<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female
<input type="submit" name="submit" value="Register">
<input type="reset">
</form>
</body>
</html>
现在我有一个 servlet 类,我尝试在其中访问表单值...如下
String i=request.getParameter(id);
String nam=request.getParameter(name);
String strea=request.getParameter(stream);
String sex=request.getParameter(sex);`
但它找不到符号 id、名称、流和性别...请指导我为什么会发生这种情况...
谢谢你