简体   繁体   中英

How to pass the text with spaces and parenthesis to java

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": "

您应该使用StringEscapeUtils.escapeJava来处理没有HTML的字符串内容

StringEscapeUtils.escapeJava("Hello 1F World (Hello World) Hello World"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM