我是java和mongodb的新手,我没有看到如何解决这个问题,我有一个集合:
get("/pages/:page", (request, response) -> {
String page = request.params(":page");
if(page.equals("forms")){
UserDAO userDao = new UserDAO(Connection.getInstance().getDataStore());
HashMap<String,Object> map = new HashMap<String,Object>();
map.put("users", userDao.AllUsers());
return new ModelAndView(map, page+".ftl");
}else{
return new ModelAndView(null, page+".ftl");
}
}, new FreeMarkerEngine());
}
java代码:
public List<User> AllUsers() throws Exception{
return this.find().asList();
}
我的AllUsers()函数
public List<String> getDomains() {
return domains;
}
pojo clas,域名
<#list users as data>
<tr class="odd gradeX">
<td>${data._id}</td>
<td>${data.active?string('yes', 'no')}</td>
<td>${data.group}</td>
<#assign x = ''>
<#assign keys = data?keys>
<#list keys as key>
<#assign x = x+','+key>
</#list>
<td>${x}</td>
</tr>
和freemarker代码
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List DataFrameExample(const DataFrame & DF) {
// access each column by name
IntegerVector a = DF["a"];
CharacterVector b = DF["b"];
DateVector c = DF["c"];
// do something
a[2] = 42;
b[1] = "foo";
c[0] = c[0] + 7; // move up a week
// create a new data frame
DataFrame NDF = DataFrame::create(Named("a")=a,
Named("b")=b,
Named("c")=c);
// and return old and new in list
return List::create(Named("origDataFrame") = DF,
Named("newDataFrame") = NDF);
}
问题是我无法访问域名
的值我希望你有人可以帮助我
提前谢谢