Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

sending parameters through redirecting

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you put those valuable into session, use session.setAttribute("name", value)
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic