Referrer page

I have implemented a search using servlets and jsp. This search starts with a form where the user writes the search criteria. When the user submits the form a doGet method from a ServletQry answers and sends back a list of results.

As this list may be too long I have added two links 'Next' and 'Previous' that uses url rewritting to pass all the parameters plus the amount of results showed.

This search must be used in more than one place of the intranet site, so I save the referrer page (request.getHeader("referer") ) as a hidden field of the form, so it is possible to go back to the page that initiated the search.

The problem is when I pass the referrer page as a parameter in the 'Next' and 'Previous' links (for example the url in the links 'Next' and 'Previous' is:

....servletQry?name=John&doc=&next=10&referrer=http://sys:8080/servletA?op=1&id=200)

When I inspect the request.getParameterMap() object, the referrer is disarmed. I cannot find 'referrer' as a parameter name, but I find

http://sys:8080/servletA?op as parameter name

and

1 as the value of this parameter

and the rest of the parameters, in this case id=2 is as other parameter but the problem is that I need it as parameter of servletA and not of servletQry

Please I need any idea of how to solve this or why is this happening.

Thank you in advance

[1434 byte] By [Desaa] at [2007-10-2 10:22:21]
# 1
WHat happens if you use the URLEncode class to encode the referrer url before adding it to the href link?
tolmanka at 2007-7-13 1:54:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
How is that? Where is the URLEncode class?
Desaa at 2007-7-13 1:54:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
I useURLEncoder.encode(parameters + "&" +"referrer" + "=" +request.getAttribute(ATR_REFERRER), "UTF-8")Is that encoding OK? Anyway it didn't work?Any idea?
Desaa at 2007-7-13 1:54:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
The problem is that I did the encoding in the wrong place. I should have done it before. I think that this was the problem. I'm trying to work it out.Thanks a lot for your help
Desaa at 2007-7-13 1:54:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...