problem with # character in java
I have a problem, I'm getting a text from a textarea, from a jsp page, I'm using struts, all works fine, but, when I write a # character, the character # not arrive to the action so, I have tried too many things, but is not work开发者_运维技巧ing, here you have some code that I'm using in the jsp page, is a javascript:
var detalle = document.getElementById("comentarioAgregado").value;
detalle = detalle.replace(/\r\n/g,"<br>");
location.href = "/SolicitudCredito/comentarioAction.do?comando=guardarParcial&comentarios="+detalle;
Thanks!
You should sanitize your query string otherwise your site is vulnerable to injection attacks.
To solve this particular problem, simply replace #
with %23
:
detalle=detalle.replace(/#/g, "%23");
精彩评论