简单的jsp问题,jsp如何返回form的值??
以下是jsp 文件:
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
receive
</title>
</head>
<%@ page import="java.util.*;"%>
<%!
public String getStr(String str)
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859.1");
String temp=new String(temp_t);
return temp;
}
catch (Exception e)
{
return null;
}
}
%>
<body bgcolor="#FFFFFF">
<%
out.println("the first method to get the request parameter.<br>");
String username=request.getParameter("username");
String nickname=request.getParameter("nickname");
String password=request.getParameter("password");
String confirmpassword=request.getParameter("confirmpassword");
out.println("usename--->"+getStr(username)+"<br>");
out.println("nickname--->"+getStr(nickname)+"<br>");
out.println("password--->"+getStr(password)+"<br>");
out.println("confirm password--->"+getStr(confirmpassword)+"<br>");
out.println(" "+"<br>");
%>
Now is <font color="blue"><%=(new java.util.Date()).toString()%></font>
<br>Location:F:\tomcat\webapps\ROOT<br>
<h1>
JBuilder Generated JSP
</h1>
</body>
</html>
以下是html文件:
<html>
<head>
<title>input interface</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form method=post action="receive.jsp">
username:<input type="text" name="username"><br>
nickname:<input type="text" name="nickname"><br>
password:<input type="password" name="password"><br>
confirmpassword:<input type="password" name="confirmpassword"><br>
<INPUT TYPE="reset"> <INPUT TYPE="submit" >
</form>
</body>
</html>
可显示服务器的时间 但返回username nicknaem password confirmpassword 的值是null