jsp中这段代码为什么input type=text取值为null,而selectr可以正常取值?
hello.jsp<%@pagecontentType="text/html;charset=gb2312"%><html><head><title>firstJSPpa...
hello.jsp
<%@page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>first JSP page</title>
</head>
<%@include file="head.jsp"%>
<body>
Hello, good evening!
<form action="response.jsp" method="post">
<table align="center" width=780>
<tr><td>请输入用户名:</td>
<td><input Type="text",name="username"></td></tr>
<tr><td>请输入该密码:</td>
<td><input Type="password",name="password",value="v"></td></tr>
<tr><td><input Type="submit",name="提交",value="v"></td>
<td><input Type="reset"</td></tr>
<tr><td><select name="choose">
<option value="you" selected>you</option>
<option value="me">me</owption>
<option value="her">her</option></td>
<td></td></tr>
</form>
</body>
</html>
response.jsp
<%@page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.*"%>
<% request.setCharacterEncoding("gb2312");%>
<h3>您好:
<%=request.getParameter("username") %>,测试另一取值:<%=request.getParameter("choose") %>[<a href="logout.jsp">注销</a>]</h3> 展开
<%@page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>first JSP page</title>
</head>
<%@include file="head.jsp"%>
<body>
Hello, good evening!
<form action="response.jsp" method="post">
<table align="center" width=780>
<tr><td>请输入用户名:</td>
<td><input Type="text",name="username"></td></tr>
<tr><td>请输入该密码:</td>
<td><input Type="password",name="password",value="v"></td></tr>
<tr><td><input Type="submit",name="提交",value="v"></td>
<td><input Type="reset"</td></tr>
<tr><td><select name="choose">
<option value="you" selected>you</option>
<option value="me">me</owption>
<option value="her">her</option></td>
<td></td></tr>
</form>
</body>
</html>
response.jsp
<%@page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.*"%>
<% request.setCharacterEncoding("gb2312");%>
<h3>您好:
<%=request.getParameter("username") %>,测试另一取值:<%=request.getParameter("choose") %>[<a href="logout.jsp">注销</a>]</h3> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询