Actually through the standard "Application Manager" I deploy my helloworld.war and get the path to the site via serverip/helloworld/ , and I would like to serverip/ but at this address the Tomcat welcome screen.

And the second problem. In 'inedx.jsp', you have to change the <form action="../LoginServlet" method="post">' to <form action="../helloworld/LoginServlet" method="post"> , which is not very convenient if there are many cool.

  • An application server may have a parameter that sets the contextPath of the web application, which is written in a server-specific descriptor. Another way is to call helloworld.war some ROOT.war. I do not know whether this rule is valid for all servers or everyone, as in the first version, also has its own specifics. See tomcat manuals, there is definitely a way. For ear applications, there is a standard method for everyone. - Sergey
  • Please ask one question next time, not two. - Nofate

1 answer 1

Each web application in Tomcat is deployed to its context. To place your application in the root context you have the following options:

  1. Delete the webapps/ROOT directory and call your WAR nickname ROOT.war .
  2. Or, configure the <Host> section of the conf/server.xml file as follows:

     <Context path="" docBase="your_app_name"> <WatchedResource>WEB-INF/web.xml</WatchedResource> </Context> 
  3. Either put reverse proxy (nginx) in front of Tomcat, which usually happens on combat servers, and do a substitution of urls.


As for the second problem, it is usually solved as follows:

 <form action="${pageContext.request.contextPath}/LoginServlet"> 

either with <c:url>

  • I understand that all three options imply access to the server's file system? And if I was given as a hosting only ip on which TomCat is raised? Can this be somehow configured through standard webmord tools? - Bogdan Shulga Nov.
  • one
    So you don’t have a VPS; - Nofate
  • This is not a VPS but only I am sitting) - Bogdan Shulga
  • one
    I have never done this, but if you deploy through Tomcat Manager, try to enter / in the Context Path field. And unlock before that, what is already deployed in / (first row in the table). - Nofate
  • one
    Take HttpServletRequest.getContextPath() - Nofate