开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜