How can I force the servlet to redirect to the welcome page without specifying the exact path? How simple is changing the path to the topmost:
response.sendRedirect("/");
Which is clearly not working.
response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/"));
The encodeRedirectURL call is necessary if you want to support session tracking for browsers with cookies disabled (i.e., by rewriting URLs).
Thanks to Michael-O above, following the solution:
response.sendRedirect(request.getContextPath());
Source: https://habr.com/ru/post/1436790/More articles:What happens if the disc is full during recording in Cassandra? - cassandraImplicit conversion from varchar to varbinary error when trying to insert an array of bytes into the database - c #Publishing an Excel Workbook on Sharepoint - vbaHow to change custom width viewForHeaderInSection after rotation - iosCannot resolve sort conflict - functionto check if javascript is available and redirect if javascript is not available - javascriptShould I use an item? - javascriptWhite space to the right of the website on mobile devices - mobileHow to wait for warnings in Selenium webdriver? - javagenealogy graphic database - pythonAll Articles