在搜索框中输入alert(7),传到后台以后,再返回前端,被自动转码为
<script>alert(7)</script>,然后前端自动转码为
<script>alert(7)</script>。我想最后在前端搜索框中显示alert(7),这个我应该怎么实现?求指教
input.val("alert(7)");不知道可不可以 我猜的
String encode = org.springframework.web.util.HtmlUtils.htmlEscape("alert(7)");
String decode = org.springframework.web.util.HtmlUtils.htmlUnescape(encode);
编码结果:<script>alert(7)</script>
解码结果alert(7)
望采纳~
应该可以后台取到值,放session里面,等返回前台的时候,input框的值直接el表达式取值,不知是否可以。