回 帖 发 新 帖 刷新版面

主题:request的问题

jsp1:


<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
reg
</title>
</head>

<body bgcolor="#ffffff">

<form action="doreg.jsp" method="post">
<table width="22%" border="0" align="center">
  <tr>
    <td colspan="2">
      <div align="center"><b><font size="+2">Reg page</font></b></div>
    </td>
  </tr>
  <tr>
    <td>
      <div align="center">username:</div>
    </td>
    <td>
      <input type="text" name="username">
    </td>
  </tr>
  <tr>
    <td>
      <div align="center">password:</div>
    </td>
    <td>
      <input type="password" name="password">
    </td>
  </tr>
  <tr>
    <td>
      <div align="center">email:</div>
    </td>
    <td>
      <input type="text" name="email">
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <div align="center">
        <input type="submit" name="ok" value="Ok">
        <input type="reset" name="cancel" value="Cancel">
      </div>
    </td>
  </tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>



jsp2:



<%@ page contentType="text/html; charset=GBK"
    import="java.util.*"
%>
<html>
<head>
<title>
doreg
</title>
</head>
<body bgcolor="#ffffff">
<%

String username = request.getParameter("username");
String password = request.getParameter("password");
String email = request.getParameter("email");


%>
</body>
</html>


为什么username,password ,email 都得不到值

回复列表 (共2个回复)

沙发

程序没问题,要在doreg.jsp加上输出语句.如<%=username%>,<%=password%>,<%=email%>等.

板凳

其实已经得到了,只是你没输出看不见而已

我来回复

您尚未登录,请登录后再回复。点此登录或注册