2

I am using Java EE and request.getQueryString() doesn't return the #hash part

my/page?id=4#hash

I am using Struts 2.

Is there any solution?

bluish
  • 26,356
  • 27
  • 122
  • 180
GorillaApe
  • 3,611
  • 10
  • 63
  • 106
  • not related to Struts2, actually (retagging) – leonbloy May 27 '10 at 20:54
  • possible duplicate of [Problem reading data from servlet get request!](http://stackoverflow.com/questions/5296325/problem-reading-data-from-servlet-get-request) – skaffman Apr 13 '11 at 14:32

2 Answers2

3

Not really. In many cases the hash tag isn't sent to the server by your client's browser.

For example, requesting this url:

http://stackoverflow.com/questions/2923610/java-getquerystring/2923618#2923618

Sends a request with these headers to the server:

GET /questions/2923610/java-getquerystring/2923618 HTTP/1.1
Host: stackoverflow.com
Kobi
  • 135,331
  • 41
  • 252
  • 292
3

The hash part of the url is (in principle) useful only to the client side, so normally the browser does not send that portion to the server. Are you sure you are interested in reading it, in the server side? Normally, you shoudn't.

For special needs, you can read here How to get Url Hash (#) from server side

Community
  • 1
  • 1
leonbloy
  • 73,180
  • 20
  • 142
  • 190