When idea writes JavaWeb, it can’t find servlet

When writing JSP, always worry about finding the location of servlet accurately
if the vallue of the servlet = (“/ myservlet”)
then use action = & lt;%= request.getContextPath()%>/ “Myservlet”, isn’t it very convenient

getcontextpath() is to find the project publishing path, that is, the root directory, while servlet value =/myservlet " represents that the servlet is in the root directory, so directly & lt;%= request.getContextPath()%>/ Myservlet can find the servlet. Similarly,
If value =/my/servlet "
then & lt;%= request.getContextPath()%>/ My/servlet is OK


Read More: