문제

I am passing a value as request attribute to the jsp page.

request.setAttribute("description", StringEscapeUtils.escapeHtml("Hello 1F World (Hello World) Hello World"));

In jsp Page I am setting in the pageContext

String text = (String) (String) request.getAttribute("description");
pageContext.setAttribute("description", text);

I have to send this text as a request parameter to the server. When I look in the firebug I see an error. I am trying to use "value" = "${text}" which throws an error. What am I doing wrong?

SyntaxError: unterminated string literal
[Break On This Error]   

{ "name": "description", "value": "
도움이 되었습니까?

해결책

You should use StringEscapeUtils.escapeJava going by the content of your string which doesn't have any HTML

StringEscapeUtils.escapeJava("Hello 1F World (Hello World) Hello World"));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top