我将一个值作为请求属性传递给jsp页面。
request.setAttribute("description", StringEscapeUtils.escapeHtml("Hello 1F World (Hello World) Hello World"));
在jsp页面中,我在pageContext中设置
String text = (String) (String) request.getAttribute("description");
pageContext.setAttribute("description", text);
我必须将此文本作为请求参数发送到服务器。当我看着萤火虫时,我发现了一个错误。我试图使用"value" = "${text}"
抛出错误。我做错了什么?
SyntaxError: unterminated string literal
[Break On This Error]
{ "name": "description", "value": "
答案 0 :(得分:2)
您应该使用StringEscapeUtils.escapeJava
字符串中没有任何HTML的内容
StringEscapeUtils.escapeJava("Hello 1F World (Hello World) Hello World"));