有沒有辦法在<c:forEach>
中通過從jOOQ循環?循環播放結果<Record> from jOOQ in <c:forEach>
這裏的getter方法:
public Vector<Map<String, String>> getUsers() {
Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
Result<Record> results = sql.select().from("users").fetch();
Vector<Map<String, String>> v = new Vector<Map<String, String>>();
for(Record item: results) {
Map<String, String> m = new HashMap<String, String>();
m.put("login", item.getValueAsString("login"));
// other columns
v.add(m);
}
return v;
}
這裏的觀點:
<c:forEach var="u" items="${users}">
${u.login} <br />
</c:forEach>
有沒有辦法讓我的getter方法簡單,如:
public Result<Record> getUsers() {
Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
reutrn sql.select().from("users").fetch();
}
但正如前面提到的我不知道如何在<c:forEach>
中循環,或者不可能?
感謝那就是我正在尋找。必須更加精彩地閱讀手冊 –