I want to get value after #
sign from URL address in jsp
http://www.example.com/testsite/sative.do?runninginformation=11-1970-1#11197011201240649438FT
How can I get it using query string?
I want to get value after #
sign from URL address in jsp
http://www.example.com/testsite/sative.do?runninginformation=11-1970-1#11197011201240649438FT
How can I get it using query string?
Try
String url = "http://www.example.com/testsite/sative.do?runninginformation=11-1970-1#11197011201240649438FT";
String f = new URI(url).getFragment();
System.out.println(f);
You can use split
, which will split the value into array.
String x = "hello#World";
String[] y = x.split("#");
System.out.print(y[1]);
how about:
"http://www.example.com/testsite/sative.do?runninginformation=11-1970-1#11197011201240649438FT".replaceAll(".*#","");
this will return 11197011201240649438FT
You can't. The value after the pound-sign (#) is never sent to the server.
You will need to do some javascript processing. Basically add an onclick-handler for each link, parse the URL of the link and extract the hash-portion and add it as a regular parameter instead.