I’m set up that when I hit the "/" I immediately flip to "/ home", but in this case the logos, styles and js are not loaded. I use bare servlets + maven is connected. Here is my redirect servlet:

@WebServlet("/") public class ServletDispatcher extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendRedirect("/home"); } } 

How to write in servlets correctly so that the folder with logos / resources and js have access?

My structure:

enter image description here

  • Add to the question how you registered, or want to register. Are you using any frameworks (Spring for example or bare servlets)? And what requests does the servlet handle (eg / *)? - MrFylypenko
  • @MrFylypenko, added. - Ponomarenko Oleh

0