Hash value for binding, therefore it is only on the client side, it is often used in the client structure, for example, angular for client-side routing.
Anchor is NOT available on the server side.
In your case, you do not need an anchor, but the value of the C # parameter will break the query string, this is the value "Transaction Log No. 459505".
EDIT A naive solution that does not work, just let it know the story, see the Real solution below
The solution is to encode the client side and decode the service side
Javascript coding
encodeURI("Transaction Log #459505") //result value "Transaction%20Log%20#459505"
Java decoding
java.net.URLDecoder.decode("Transaction%20Log%20#459505"); //result "Transaction Log #459505"
EDIT: But: Javascript is not encoded in the same way as Java, so the correct answer (hopefully) is to manually replace all of your # with% 23, then Java will decode it normally or use encodeURIComponent as suggested in the comments. For your need, a replacement solution seems sufficient.
Encode in Javascript:
encodeURI("yourUrl/Transaction Log #459505").replace(/#/,"%23") //result: yourUrl/Transaction%20Log%20%23459505
Decoding in Java does not change
java.net.URLDecoder.decode("Transaction%20Log%20#459505") // result (java.lang.String) Transaction Log
Sorry for the long post, I did not see the difference between Java and JavaScrip Url encoding