V
V
Viktoria Smirnova2017-08-14 09:39:08
Java
Viktoria Smirnova, 2017-08-14 09:39:08

How to infer class method in JSP from servlet?

How would it be correct to indicate in

request.setAttribute


public class Servlet extends HttpServlet {

public class PrintText {
    public void printText() throws Exception {
              System.out.println("Hello!");
    }
}

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

         PrintText p = new PrintText();
         p.printText();
         request.setAttribute(--------); 
         request.getRequestDispatcher("/WEB-INF/index.jsp").forward(request, response);
    }
    }


in JSP ${}:
<html>
<body>
<p>${-------}</p> 
</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Baranenko, 2017-08-22
@drno-reg

in servlet in JSP
<p>${example1}</p>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question