In a Java servlet, how might I put the object to servlet response? In the code below, the name is shown on the page.
servlet:
private void process(HttpServletRequest request, HttpServletResponse response) throws Exception{
String name = "John";
System.out.println("main servlet");
request.setAttribute("name", name);
response.sendRedirect("index.jsp");
}
index.jsp in JSTL
<body>
name: ${requestScope.name}
</body>