I want to learn programming people are very familiar with 404 and 500 are very sensitive. I encountered these two errors many times while making the DRP system, so I met him today and let me remember him, that is a "/":
This is to say that JSP problem, and can not find, learn Java students know Servlet/item is I set up a servlet after a virtual folder. The configuration files are written like this:
<servlet><servlet-name>AddItemServlet</servlet-name><servlet-class> Com.bjpowernode.drp.basedata.web.additemservlet</servlet-class></servlet><servlet-mapping> <servlet-name>additemservlet</servlet-name><url-pattern>/servlet/item/additemservlet</ Url-pattern></servlet-mapping>
The above configuration file is not a problem, the following is my JSP is more critical and easy error, and I went wrong place: path problem
<body class= "body1" ><form name= "Itemform" id= "Itemform" action= "<span style=" Background-color:rgb ( 255, 0, 0); " >/servlet/item/AddItemServlet</span> "method=" POST "onsubmit=" return Validateform (This) ">
This red place seems to be no problem, is to request the servlet, but when I click on the button to jump, but error, this is added "/"And not to add"/"The difference, because I added the BasePath (recommended blog) in the JSP, that is, the Web full path:
<%string path = Request.getcontextpath (); String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%>
Path-------------------------------------------------------/servlet/item/additemservlet
BasePath---http+://+localhost+:+8181+/servlet/item/additemservlet+/(http://localhost:8181/servlet/item/additemservlet)
And I added "/" to the code and then the address becomes http://localhost:8181//Servlet/item/additemservlet
So we can see a "/" we can not ignore, which has become a problem in my future experience. Share the ~ ~
HTTP Status 404-/servlet/item/additemservlet