javascript如何将jQueryAjax上的html实体传递给java
基本上我有一个带文本框的表格
一些输入值包含html实体(特别是<;,>;)
说“我输入”<并传递我的价值观:
var theDescription = $("#inMaintDescription").val()
$.ajax( {
url : "Ajax.faces",
type : "GET",
cache : false,
contentType : 'application/json; charset=utf-8',
data : {
description: theDescription
然而,当它到达java时,就变成了
String theDescription = inRequest.getParameter(RequestConstants.AJAX_REQUEST_VARIABLE_DESCRIPTION);
描述字面上是<
而不是<
如何输入<;在我的文本框中,java字符串作为<?java上的字符串替换是唯一的方法吗
# 1 楼答案
您可以尝试使用Apache Commons StringEscapeUtils。unescapethml4()