grails中Template

来源:互联网 发布:数据统计分析怎么写 编辑:程序博客网 时间:2024/06/05 05:44

引用hivon的CSDN博客,网址:http://blog.csdn.net/hivon/article/details/2315399

<input type="button" value="report3" onclick="window.location.href='<g:createLink controller="report" action="bar3" />'"></input>
<input type="button" value="report4" onclick="window.location.href='<g:createLink controller="report" action="bar4" />'"></input>
 <input type="button" value="pie1" onclick="window.location.href='<g:createLink controller="report" action="pie1" />'"></input>
。。。。。。。

可以用template模板,一般来说,以下划线开头的文件名的gsp文件都是Template。所以我把我的第一个Template命名为_test.gsp:

<input type="button" value="${value}" onclick="window.location.href='<g:createLink controller="${control}" action="${action}" />'"></input>

包含三个变量:value、control和action。

引用为:<g:render template="test" model="[value:'nulti',control:'report',action:'multi']"/>

即可。

0 0
原创粉丝点击