通过form把input中的值传到servlet中出错,servlet测试过是正常的。运行以后显示错误为:
405 POST not supported
--------------------------------------------------------------------------------
Resin-3.0.15 (built Wed, 16 Nov 2005 11:15:43 PST) 
<!--Sayhi.html
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Sayhi.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    
  </head>
  
  <body>
    <form name="form1" method="post" action="servlet/Sayhi">
     <input type="text" name="Sayhi">
     <input type="submit" value="submit">
     <input type="reset" value="reset">
    </form>
  </body>
</html><!--web.xml
-->
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <servlet>
    <description>This is the description of my J2EE component</description>
    <display-name>This is the display name of my J2EE component</display-name>
    <servlet-name>Sayhi</servlet-name>
    <servlet-class>servlet.Sayhi</servlet-class>
    
    <init-param>
     <param-name>user</param-name>
     <param-value>getInitParameter</param-value>
    </init-param>
  </servlet>  <servlet-mapping>
    <servlet-name>Sayhi</servlet-name>
    <url-pattern>/servlet/Sayhi</url-pattern>
  </servlet-mapping>
 
</web-app>
//Sayhi.javapackage servlet;import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;public class Sayhi extends HttpServlet
{
String initInfo;


public void init(ServletConfig config)throws
ServletException{
super.init(config);
initInfo = config.getInitParameter("user");
}

public void doGet(HttpServletRequest request,
HttpServletResponse response)throws
ServletException,IOException{
response.setContentType("text/html;charset=gb2312");

request.setCharacterEncoding("gb2312");
PrintWriter out = response.getWriter();

out.println("<html><head><title></title></head>");
out.println("<body>" + request.getParameter("Sayhi"));
out.println("</body></html>");

out.close();
}

public String getServletInfo(){
return "servlet.Sayhi Information";
}

public void destory(){}
}