我有一个servlet调度程序
当我使用无论如何传递价值时,我总是失败。
这是我的错误消息
javax.servlet.ServletException: Servlet execution threw an exception
servlet.checkServlet.doPost(checkServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
java.lang.StackOverflowError
org.apache.catalina.connector.Request.notifyAttributeAssigned(Request.java:1489)
org.apache.catalina.connector.Request.setAttribute(Request.java:1475)
org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:539)
servlet.checkServlet.doPost(checkServlet.java:18)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
servlet.checkServlet.doPost(checkServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
的web.xml
<web-app>
<servlet>
<servlet-name>checkServlet</servlet-name>
<servlet-class>checkServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>checkServlet</servlet-name>
<http-method>Get</http-method>
<http-method>Post</http-method>
<url-pattern>/checkview.jsp</url-pattern>
</servlet-mapping>
</web-app>
servlet.java
public class checkServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setAttribute("books", "book1");
request.getRequestDispatcher("/checkview.jsp") .include(request,response);
}
}
最后是我的jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<% String msg = (String)request.getAttribute("book"); %>
<!doctype html>
<html lang="en">
<head>
</head>
<body>
form servlet: <%= msg %>
</body>
</html>
有没有人可以教我如何修复以及为什么会出现这个问题?