-1

I have some app, where a user going to link like "..app/page/par", should be redirected to page "..app/page" and then on it page should be add some data, that I should get using parameter "par"

How can I do it, using java servlets?

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95

1 Answers1

0

The session scope can be used to store the parameter value on the server side between the two requests.

Request 1 app/page/par

String parameterValue = request.getParameter("par");
request.getSession().setAttribute("par", parameterValue);
response.sendRedirect("app/page");

Request 2 app/page

// pass the value to the view
request.setAttribute("viewAttributeName", request.getSession().getAttribute("par"));
Serge
  • 194
  • 6