0
Iam使用grails在我的項目中使用分頁執行搜索功能。使用下面的代碼,我可以看到max = 5的第一個resultSet,但是當我點擊「next」時,它不返回任何數據。grails分頁列表無法正常工作
下面是代碼段: 控制器的代碼:使用empDetailsList在GSP用於分頁
def userlist = criteria.list(max:searchCommand.max, offset:searchCommand.offset){
userProfiles {
like ('firstName', "${searchCommand.firstName}%")
like ('lastName', "${searchCommand.lastName}%")
}
employees {
like ('employeeNum', "${searchCommand.employeeNum}%")
like ('payeNum', "${searchCommand.payeNum}%")
}
}
List <SearchCommand> searchCommandList = new ArrayList<SearchCommand>()
for(userObject in userlist) {
SearchCommand searchCommandObj = new SearchCommand()
def user = userObject as SchemeUser
UserProfile userprofile = UserProfile.findBySchemeUser(user)
searchCommandObj.firstName = userprofile.firstName
searchCommandObj.lastName = userprofile.lastName
println "userprofile.firstName : " + userprofile.firstName
Employee emp = Employee.findByUser(user)
searchCommandObj.employeeNum = emp.employeeNum
searchCommandObj.payeNum = emp.payeNum
searchCommandList.add(searchCommandObj)
}
return searchCommandList
蔭:
服務代碼。
我需要解決什麼問題,以便gsp在點擊'下一步'時正確顯示分頁結果?