标签:
在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>
标签:
原文地址:http://www.cnblogs.com/chenyongjun/p/4456208.html