我成功将csv文件上传到grails并列出了上传的文件。但是,如何在用户界面中通过分页,搜索/过滤和列排序查看上传的文件?
我的上传功能
def upload() {
def file = request.getFile('file')
if(file.empty) {
flash.message = "File cannot be empty"
render(view: 'create')
} else {
def documentInstance = new Document()
documentInstance.filename = file.originalFilename
documentInstance.type = file.contentType
documentInstance.fullPath = grailsApplication.config.uploadFolder +file.originalFilename
file.transferTo(new File(documentInstance.fullPath))
documentInstance.save()
我的upload.gsp
<html>
<head>
<meta name="layout" content="main">
<title>Upload New Document</title>
</head>
<body>
<div class="nav" role="navigation">
<ul><li><g:link class="list" action="list">Document List</g:link></li></ul>
</div>
<div class="content scaffold-create" role="main">
<h1>Upload New Document</h1>
<g:if test="${flash.message}"><div class="message" role="status">${flash.message}</div></g:if>
<g:uploadForm action="upload">
<fieldset class="form">
<input type="file" name="file" />
</fieldset>
<fieldset class="buttons">
<g:submitButton name="upload" class="save" value="Upload" />
</fieldset>
</g:uploadForm>
</div>
</body>
现在,如何查看具有上述规范的CSV文件的内容?