Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I sendRedirect to where I came from without using cookies?

Posted on 2004-04-15
12
Medium Priority
?
294 Views
Last Modified: 2012-08-14
On a several different jsp pages I have the button that calls a servlet and processes data.  After the processing is complete I want to go back to the page where the button was hit.  The problem is I could have come from one of three pages. Is there anyway to determine this other than using a cookie or session variable?
0
Comment
Question by:mtiGirl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
12 Comments
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 400 total points
ID: 10837277
history.back();
or
history.go(-1);

Cd&
0
 
LVL 19

Expert Comment

by:dakyd
ID: 10837307
Could you pass in the location of the page that calls the servlet to the servlet?  

In every page that has the button, make sure that document.location is included as part of the request.  Then the servlet can use this parameter as the page to return to.  Hope that helps.
0
 

Author Comment

by:mtiGirl
ID: 10837345
How do I make the document.location part of the request?

Thanks for the input!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 400 total points
ID: 10837421
Oh server back to client.  Everythng you need to return to the client is in the HTTP header.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10837526
Glad we could help.  Thanks for the A. :^)

Cd&
0
 

Author Comment

by:mtiGirl
ID: 10837535
THANK YOU!
0
 

Author Comment

by:mtiGirl
ID: 10837591
How so I retrive the url where I came from using getHeaderField (I assume this is what you are talking about above) what name do I use as a parameter in order to return the url?  Or do I set it before I call the servlet?  I do not see a setHeaderField in the java api?  Any help would be appreciated.


--API for URLConnection

getHeaderField
public String getHeaderField(String name)
Returns the value of the named header field.
If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.


Parameters:
name - the name of a header field.
Returns:
the value of the named header field, or null if there is no such field in the header.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10837728
Assuming the header is using the HTTP standard then the name of the return address field is: REMOTE_ADDR

There is a list of the header variables here:

http://hoohoo.ncsa.uiuc.edu/cgi/env.html

Cd&


0
 

Author Comment

by:mtiGirl
ID: 10837790
Thanks a million -- that got it.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10837915
:^)

Just  a hint to help you using the site in the future.  Don't be too quick to accept an answer until you have gotten all the way through.  Some expert don't follow up as well as they should and may not continue the dialog after the question has been awarded.

Cd&
0
 
LVL 19

Expert Comment

by:dakyd
ID: 10838649
That'd be me COBOL's talking about ... sorry, was away from computer and couldn't get back to your question until now.  Sounds like you got what you needed, though.  Thanks for the A.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10838673
No I was not referring to you.  There are "top-experts" who are easy and obvious targets.  You don't have enough track record to be criticized yet. :^)

Welcome to the site... if you need any help just email me or any of the other page editors.

Cd&
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question