我正在尝试在JSF(.jsp)文件中实现jQuery的自动完成功能。事情很好但我无法从托管bean中获取列表到脚本中的变量。请帮帮我。
JSP代码:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
var availableTags = "#{aCTestBean.placesList}";
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<f:view>
<label for="tags">Symbol: </label>
<h:form id="watchListForm">
<h:inputText id="tags" />
</h:form>
</f:view>
</body>
</html>
错误:HTTP状态500 - /AutoComplete.jsp(第14行,第24列)模板文本中不允许#{...}