为什么我的配置都是对了,servlet在浏览器里还是显示不出来啊?
//这是我的servlet文件,有class文件在dopost\WebRoot\WEB-INF\classes\post下生成
package post;
import
java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import
javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SerPost extends HttpServlet
{
private static final String CONTENT_TYPE = "text/html;charset=GBK ";
public void init() throws
ServletException{}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,
IOException {
request.setCharacterEncoding(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println( " <html> ");
out.println( " <head> \n <title> \nSerPost\n </title> \n </head> ");
out.println( " <body> ");
out.println( " <p> The Servlet has received a POST.This is the reply. </p> ");
Enumeration e = request.getParameterNames();
while (e.hasMoreElements())
{
String name = (String)e.nextElement();
String value = request.getParameter(name);
out.println(name+ "=== "+value);
}
out.println( " </body> \n </html> ");
}
public void destroy(){}
}
//我的jsp文件,路径dopost\WebRoot\dopost.jsp这个可以显示
<%@ page language= "java " pageEncoding= "UTF-8 "%>
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html;charset=UTF-8 ">
<title> DoPost </title>
</head>
<body>
<form action= "/SerPost " method= "post ">
<p> Press Submit to post to Servlet SerPost </p>
<p> name::: <input type= "text " name= "name " value= " "> </p>
<p> password::: <input type= "text " name= "password " value= " "> </p>
<p> <input type= "submit " name= "Submit " value= "Submit ">
<input type= "reset " value= "Reset "> </p>
</form>
</body>
</html>
//我的web.xml配置
<?xml ve