first, sorry english it's not native language.
so, working on application in jsp , in 1 of forms have field "comments". when submit form, value of field sent servlet ajax request.
var request = 'mainservlet?command=sendrequest'; request += ('&comments=' + $('#comments').val()); but when there "<" or ">" in field, $('#comments').val() translate them "<" or "&gl". exemple, converted < ;test&gl ;
and when want recover value in servlet, do:
string comments = request.getparameter("comments"); but url looks : mainservlet?command=sendrequest&comments=< ;test&gl ;
so request.getparameter("comments"); returns empty string.
i thought replace string < own code , replace again in servlet, there simpler way this?
thanks.
edit: after, reuse comments in other jsp.
i believe need encodeuricomponent function. convert string format can use inside uri.
just remember decode on receiving end, believe urldecoder class can you.
Comments
Post a Comment