为什么jsp中form表单向serverlet提交数据,显示文件错误,请大神帮我分析一下什么地方出错了

<body>  form表单
    <form action="web/HelloWorld" name="form" method="get">
      Name:<input type="text" name="Name" max="20"/><br/>
      Pasd:<input type="password" name="Pasd" max="10"/><br/>
      <input type="submit" name="Name" value="tijiao"/><
    </form>
    <%=request.getContextPath() %>

  </body>

实体的serverlet类

package com.liqiang.web;


import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse


public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name=request.getParameter("Name");
String Pasd=request.getParameter("Pasd");
System.out.println("hello world "+name+"\t"+Pasd);
try {
Thread.sleep(5000);
System.out.println("现在将内容重定向去index界面中");
response.sendRedirect("http://www.bai.com");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void init() throws ServletException {

}

}


<servlet>  XMl 文件的配置
  <servlet-name>HelloWorld</servlet-name>
  <servlet-class>com.liqiang.web.HelloWorld</servlet-class>
  </servlet>
  <servlet-mapping>
  <servlet-name>HelloWorld</servlet-name>
  <url-pattern>/HelloWorld</url-pattern>
  </servlet-mapping>

</web-app>



展开阅读全文

没有更多推荐了,返回首页