How do you access URL text following the # sign through Java?

Posted by cmcculloh on Stack Overflow See other posts from Stack Overflow or by cmcculloh
Published on 2010-05-10T20:58:34Z Indexed on 2010/05/10 21:04 UTC
Read the original article Hit count: 259

Filed under:
|
|

Using Java (.jsp or whatever) is there a way where I can send a request for this page:

http://www.mystore.com/store/shelf.jsp?category=mens#page=2

and have the Java code parse the URL and see the #page=2 and respond accordingly?

Basically, I'm looking for the Java code that allows me to access the characters following the hash tag.

The reason I'm doing this is that I want to load subsequent pages via AJAX (on my shelf) and then allow the user to copy and paste the URL and send it to a friend. Without the ability of Java being able to read the characters following the hash tag I'm uncertain as to how I would manipulate the URL with Javascript in a way that the server would be able to also read without causing the page to re-load.

I'm having trouble even figuring out how to access/see the entire URL (http://www.mystore.com/store/shelf.jsp?category=mens#page=2) from within my Java code...

© Stack Overflow or respective owner

Related posts about java

Related posts about url