码迷,mamicode.com
首页 > Web开发 > 详细

Grails中Js引用params

时间:2015-04-25 18:04:24      阅读:662      评论:0      收藏:0      [点我收藏+]

标签:

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

  

  

 

Grails中Js引用params

标签:

原文地址:http://www.cnblogs.com/chenyongjun/p/4456208.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!