在Js中引用params
> controller/action
def list(){
LineChartService lineChart = new LineChartService()
lineChart.setTitle("Title")
params.hello = "hello"
params.lineChart = lineChart
}
> gsp文件
<%@ page import="chartdemo.LineChartService" %>
<html>
<head>
</head>
<body>
<%
LineChartService lineChart = (LineChartService)params.lineChart
%>
<script>
var title = "${lineChart.getTitle()}"; // 直接使用service
var hello = "${params.hello}"; // 使用params中变量
alert(hello + " " + title);
</script>
</body>
</html>