Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forwarding to external site

 
Anurag Saxena
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
My servlet need to forward users to an external site with some value that will be passed along (e.g., http://www.xxxx.com?val1=a&val2=b)
I can't use request dispatcher since this is an external site. If I create a URL object and use URLConnection.connect()I have following quetions:
(1) Can I use same URL connection objects for all the users?
(2) if yes, how am I going to set the values (val1 and val2) for different users?
(3) Once I redirect the user to that external site I am done with that user, Do I need to do any thing different?
regards,
Anurag
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What prevents you from doing a simple redirect?
bear
 
Jai Sund
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag,
What Bear is suggesting is to use
response.sendRedirect("http://www.xxx.com?var1=val1");
inside your servlet's service or doXXX() method.
-Jai
SCJP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic