commit
d73b78710e
|
@ -1,6 +1,5 @@
|
||||||
package com.baeldung.servlets;
|
package com.baeldung.servlets;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
|
@ -18,10 +17,14 @@ public class UpdateServlet extends HttpServlet {
|
||||||
|
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
|
if (session != null) {
|
||||||
|
|
||||||
session.setAttribute("userName", request.getParameter("userName"));
|
session.setAttribute("userName", request.getParameter("userName"));
|
||||||
session.setAttribute("age", request.getParameter("age"));
|
session.setAttribute("age", request.getParameter("age"));
|
||||||
|
|
||||||
request.setAttribute("sessionData", session);
|
request.setAttribute("sessionData", session);
|
||||||
|
}
|
||||||
|
|
||||||
RequestDispatcher requestDispather = request.getRequestDispatcher("update.jsp");
|
RequestDispatcher requestDispather = request.getRequestDispatcher("update.jsp");
|
||||||
|
|
||||||
requestDispather.forward(request, response);
|
requestDispather.forward(request, response);
|
||||||
|
|
Loading…
Reference in New Issue