日期:2014-05-18  浏览次数:20740 次

大家帮我看下这段传递数据的代码哪里错了。在线等
我在书上见到的源代码:
menu14.jsp

<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>用户登录</title>
</head>
<body>
<center>
<%
if(request.getParameter("username")!=null)
{
%>
<jsp:forward page="menu15.jsp">
<jsp:param name="username" value="<%=request.getParameter("username")%>"/>
<jsp:param name="telephone" value="<%=request.getParameter("telephone")%>"/>
<jsp:param name="address" value="<%=request.getParameter("address")%>"/>
<jsp:param name="username" value="<%=request.getParameter("name")%>"/>
</jsp:forward>
<%
}
else
{
%> <form action="" name="frm3" method="post">
  <table width="490" border="1">
  <tr>
  <td colspan="2"><div align="center">
  <strong>输入联系人信息</strong></div></td></tr>
  <tr>
  <td width="89">用户名:</td>
  <td width="385"><input name="username" type="text" id="name" size="15" /></td>
  </tr>
  <tr>
  <td>电话:</td>
  <td><div align="left">
  <input name="telephone" type="text" id="telephone" size="20" />
  </div></td>
  </tr>
  <tr>
  <td>家庭住址</td>
<td ><input name="address" type="text" id="address" size="50" /></td>
</tr>
<tr>
<td>邮政编码:</td>
<td><div align="left">
<input name="postcode" type="text" id="postcode" size="10" />
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="Reset" type="reset" id="Reset" value="重置" />
<input type="submit" name="Submit" value="提交" />
</div></td></tr></table>
</form>
<%}%> </center></body>
</html>

menu15.jsp

<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head><title>用户登录</title>
</head>
<body>
<center>
<table width="490" border="1">
<tr>
<td colspan="2"><div align="center">
<strong>你输入的联系人信息如下</strong>
</div>
</td></tr>
<%request.setCharacterEncoding("gb2312");%>
<tr>
<td width="89">用户名:</td>
<td width="385"><%=request.getParameter("username")%></td>
</tr>
<tr><td>电话:</td>
<td>
<%=request.getParameter("telephone")%>
</td>
</tr>
<tr>
<td>家庭住址:</td>
<td><%=request.getParameter("address")%></td>
</tr>
<tr>
<td>邮政编码:</td><td>
<%=request.getParameter("postcode")%>
</td></tr&