I am trying to get a request string that has the character #
and my parameter is got only until the #
. But the thing is that I need to have this character, can't remove it.
Any idea?
I am trying to get a request string that has the character #
and my parameter is got only until the #
. But the thing is that I need to have this character, can't remove it.
Any idea?
Encode the # if it has to be there. A literal # indicates a fragment id and can't be used in a URI for any other purpose. w3schools has encoding tables so you can look up the values yourself, too.
You need to encode the parameter value correctly.
If the URL is generated by a JSP, make sure to use the JSTL c:url
tag:
<c:url value="/path/to/myServlet">
<c:param name="param1" value="#paramValue"/>
</c:url>
If you're using straight Java, use URLEncoder.encode()
.
If the URL is static, use %23paramValue
instead of #paramValue