I have a servlet running on tomcat 6 which should be called as follows:
http://<server>/Address/Details?summary="Acme & co"
However: when I iterate through the parameters in the servlet code:
//...
while (paramNames.hasMoreElements()) {
paramName = (String) paramNames.nextElement();
if (paramName.equals("summary")) {
summary = request.getParameter(paramName).toString();
}
}
//...
the value of summary
is "Acme "
.
I assume tomcat ignores the quotes - so it sees "& co"
as a second parameter (albeit improperly formed: there's no =...
).
So: is there any way to avoid this? I want the value of summary
to be "Acme & co"
. I tried replacing '&' in the URL with &
but that doesn't work (presumably because it's decoded back to a straight '&' before the params are parsed out).
Thanks.