项目启动显示首页,代码如下
public void index() { String extSql = null != getSessionAttr(Const.TOKEN) ? "" : "where pub = true"; Page<Record> recodePageList = Db.paginateByCache("blogPageList", "", getPageNum(), getPageSize(), "select *", "from t_blog " + extSql + "order by id desc"); List<Record> recordList = recodePageList.getList(); recordList.forEach(record -> { Date createTime = record.getDate("createTime"); record.set("createTime", BlogKit.date2Str(createTime)); }); setAttr("blogList", recordList); render("index.html"); }
在index.html页面使用for遍历blogList,为什么不显示?
#for(blog : blogList) <div class="article shadow"> <div class="article-right"> <span class="article-title-left">原创</span> <div class="triangle-right"></div> <h2 class="article-title"> <a href="">#(blog.title)</a> </h2> <div class="article-footer"> <span><i class="fa fa-clock-o"></i> #(blog.createTime)</span> <span><i class="fa fa-tag"></i> <a href="#">#(blog.tag)</a></span> </div> </div> <div class="clear"></div> </div> #else <div class="article shadow"> 尚未发布文章 </div> #end
另外,项目引入jetty和IDEA集成,怎么进入debug?
<dependency> <groupId>com.jfinal</groupId> <artifactId>jetty-server</artifactId> <version>8.1.8</version> <scope>compile</scope> </dependency>
项目:JFinal
点击鼠标右键,选择 debug即可