1

I want to pass a string between 2 jsp pages I have tried this but it didn't work :

JSP Page 1

String it=request.getParameter("select");

 request.setAttribute("remove", it);

JSP Page 2

String RemovedItem = request.getAttribute("remove");
Sara
  • 13
  • 3
  • possible duplicate of [How to pass value from one jsp to another jsp page?](http://stackoverflow.com/questions/22369717/how-to-pass-value-from-one-jsp-to-another-jsp-page) – vels4j Dec 10 '14 at 13:47

1 Answers1

0

There are many ways to accomplish this:

The easiest is to pass attributes in session object.

JSP1:

session.setAttribute("param1","some value here");

JSP2:

String param1 = session.getAttribute("param1").toString();
session.removeAttribute("param1");

Another way is by using url parameters using the response.sendRedirect():

JSP1:

response.sendRedirect("jsp2.jsp?param1=param value&param2=value for param2");

JSP2:

String param1 = request.getParameter("param1"); //param value
String param2 = request.getParameter("param2"); //value for param2
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125