質問

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