denglu.jsp文件
<form id="form1" name="form1" method="post" action="yanzheng.jsp">
<table width="236" border="1" cellspacing="2" bordercolor="#000000" bgcolor="#0099FF">
<tr>
<td width="226"><label>账号:
<input type="text" name="username" />
</label></td>
</tr>
<tr>
<td><label>密码:
<input type="text" name="password" />
</label></td>
</tr>
<%
request.setAttribute("city","新疆");
%>
<tr>
<td><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
</form>
yanzheng.jsp文件
<%
out.println("<br>账户:");
out.print(request.getParameter("username"));
out.println("<br>密码:");
out.print(request.getParameter("password"));
out.println("<br>城市:");
out.print(request.getAttribute("city"));
%>
点击确定为什么不能接受到 city 的数据??
request.setAttribute("city","新疆");是不是可以使用out.print(request.getAttribute("city"));接受并显示??