Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending parameters through redirecting

 
sachin dabhade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am redirecting my page using following command from my jsp
out.println("<meta http-equiv=\"refresh\" content=\"2;url=login.jsp\">")
i want to know how can i send the parameters from my original jsp to the one i am redirecting.
i.e i want to send parameters like user id and password to
login.jsp from signup.jsp
my page is like
signup.jsp is generating a dynamic page for thanking and after 2 seconds i want to redirect the page to login.jsp where i want to user parameters like user id and password.
thanks in advance

 
Cynthia Yao
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you put those valuable into session, use session.setAttribute("name", value)
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sachin,
If you are looking to redirect, using URLWriting, you can do it by using encodeRedirectURL(), and sendRedirect() methods of the HttpServletResponse class.
Alternatively you can use the RequestDispatcher class and use the forward() method of this class.
In either case, you may append the parameters to the URL after the "?" e.g. http://localhost:8080/Signup.jsp?username=xxxx&password=xxxx.
Just remember that in both the cases you would need to use the http method=POST (I am not very sure with the RequestDispatcher case, please confirm and post the message here if you try it!!)
Hope this helps,


------------------
Sandeep Desai
vgdesai@vsnl.com

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would recommend using the res.forward() solution since it simply passes along the original request and headers to the next in line.
Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic