• Post Reply Bookmark Topic Watch Topic
  • New Topic

send variable from servlet and receive it in JSP

 
mocca az
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings!
My question is quite straight forward. How to send variable from servlet and receive it in JSP.
I have some processing done, then use sendRedirect("page.jsp"). I need to get value from one of the variables and receive it to jsp.
thank you,
m, phx
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, depending on the problem, forward() and include() on the RequestDispatcher are usually prefered to sendRedirect since it all happens on the server and they can share the same request and response objects.
If you use sendRedirect you can URL encode your information ie res.sendRedirect("/MyServlet?usedId=kajswlf");
If you use forward or include, you can set and get Attributes (Objects) on the request object.
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!