在控制器中,如何将json视图输出重定向到文件而不是http响应?
Grails 3.2.5。
答案 0 :(得分:0)
你可以这样做......
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="content"></div>
<button class="check">Check</button>
答案 1 :(得分:0)
另一个简单的选择是:
def action() {
def json = [ key1:'value1', key2:[ key21:'value21' ]
new File( '/the/path' ).withOutputStream{ it << ( json as JSON ) }
[ some:result ]
}