Grails 顯示資料

2021-08-02 05:56:55 字數 756 閱讀 3865

一、顯示資料

1. 在controller中建立乙個showlistcontroller

從資料庫中獲取資料

def

show(){}

//ware是乙個實體類(在資料庫中有同名的表)

//儲存在list中

//乙個方法

def getlist()

//全域性變數 list

$scope.list = ;

//寫js的方法

$scope.getlist= function

(),headers : window.utf8_headers})

.success(function

(r***ata, status, headers, config)}

td>

}td>

}td>

}td>

}td>

4.show.gsp與show.js要有乙個對應

show.gsp中

在中最大的div

show.js中

//定義自己的乙個id

// controller 『showlistctr』要與gsp中的ng-controller="showlistctr"對應

grails安裝部署 Grails資料庫及中文配置

你的位置 技術文件 web 文件詳情 grails資料庫及中文配置 1.資料庫配置檔案內容 datasource pooled false driverclassname com.mysql.jdbc.driver username root password 123456 hibernate ca...

Grails附件刪除

try 刪除檔案 if articleinstance.durl 獲得刪除檔案路徑 def webrootdir servletcontext.getrealpath configobject configobject configurationholder.getconfig def webroo...

如何開始Grails

設定環境變數,grails home d greensoft grails 0.5,並在path中加上 d greensoft grails 0.5 bin 準備工具ok,現在可以在命令視窗中,進入到合適的目錄,如 d projects 然後鍵入 grails,此時如果有提示資訊則說明配置正確,可以...