测试

Grails中Js引用params

在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>

  

  

 

posted @ 2015-04-25 17:07  Genter  阅读(781)  评论(0编辑  收藏  举报

测试