index里面
pageEncoding="utf-8"%>
Insert title hereHelloservlet里面的代码如下,没有配置web.xml因为已经有了注解
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Helloservlet
*/
@WebServlet("/Helloservlet")
public class Helloservlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public Helloservlet() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
response.getWriter().append("Served at: ").append(request.getContextPath());
System.out.println("很好");
PrintWriter out=response.getWriter();
response.setContentType("text/html;charset=utf-8");
out.println("xixi");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
System.out.println("很好");
PrintWriter out=response.getWriter();
response.setContentType("text/html;charset=utf-8");
out.println("xixi");
}
}
但是一直出现以下问题,已经一个消失了都没有解决成功,求大神来解答