-1

I'm interested how I can get the String "Cables" from this http:

http://122.211.222.137:8080/test/RackProfile.jsf?id=1122#Cables

I use this in order to get the id:

this.id = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id"));

But I don't know how to get the string after "#". Any ideas?

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

4

The hash fragment of the URL does not get sent to the server, thus it's not accessible via getRequestParameterMap. It's typically used only by the user agent, i.e., the web browser.

A possible solution, is before submiting the form back to the server, try to modify the url, to something like the following:

http://122.211.222.137:8080/test/RackProfile.jsf?id=1122&type=Cables

Or maybe use hidden field to store its value, and grab it in the server.

Community
  • 1
  • 1
João Silva
  • 89,303
  • 29
  • 152
  • 158