Hi, How to manipulate ampersand character in JSP's. I need to use '&' char in the URL string. For ex: "../test.jsp?id=1059&title=Test for RM&DRT". Here I can get id using request.getParameter("id") and same as title. But title I am getting as 'Test for RM', I am missing '&DRT. I know '&' seperates parameters, but I need to send 'Test for RM&DRT' as whole URL string. I tried '&' char with %26 char, its working fine if I hardcode it in browser. I want to send it from a JSP page to another JSP page. Could anyone please suggest me how to solve the problem. thanks,
You need to use the UrlEncoder class to encode the parameter's value e.g. String s = "ab&d defgh"; String paramvalue = URLEncoder.encode(s); you can then pass this encoded value intact in the url and use URLDecoder.decode to decode the value. Hope this helps!
subject: how to manipulate ampersand(&) char in JSP query string