tags:

views:

44

answers:

2

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...

+3  A: 

You can't.

The fragment identifier is only used client side, so it isn't sent to the server.

You have to parse it out with JavaScript, and then run your Ajax routines.

If you are loading entire pages (and just leaving some navigation and branding behind) then it almost certainly isn't worth using Ajax for this in the first place. Regular links work better.

David Dorward
Dang, that sucks...
cmcculloh
A: 

Why can't you use a URL like this:

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

If you want the data to be stored in the url, it's gotta be in the query string.

Eric
because I am doing URL manipulation through JavaScript. if I updated the URL to be page=2 instead of page=1 it would reload the page.
cmcculloh