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

  

  

 

相关文章:

  • 2022-02-05
  • 2021-11-13
  • 2021-08-28
  • 2021-08-07
  • 2021-09-07
  • 2021-10-31
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2021-07-14
  • 2021-10-23
  • 2022-12-23
  • 2021-04-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案