Hello, please tell me how to make it so that when you first go to the servlet by url ( http: // localhost: 8080 / Servlet ), it is passed to action = 1? (you need to do this inside the servlet, without configuration)

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); int action = Integer.parseInt(request.getParameter("index")); String errorMessage = (String) session.getAttribute("connectionError"); if (errorMessage != null) { userMessageError(out); } else { ProfileDAO instance = (ProfileDAO) session.getAttribute("DAO"); try { Profile profile = new Profile(); if (action != 0) { switch (action) { case 1: List<Profile> list = instance.selectAllProfiles(); displayTable(out, list); break; 
  • one
    Maybe somehow? String index = request.getParameter ("index"); int action = (index! = null? Integer.parseInt (index): 1); - Russtam
  • Thank you, it works! - PolkovnikJ

0