2018-08-31 14:42
@房上的猫 重定向时不要直接定向到 html 文件,而是定向到一个 action,例如你先创建一个 action :
public void index() {
render("index.html");
}
然后定向时直接定向到上面那个 action ,假定上个 action 的路由是 "/",则代码为:
redirect("/");
原因与前面的是类似的,希望 jfinal 对 html 进行渲染,就一定要走模板引擎,也就是在 action 中走一个 render 方法,而 redirect 方法是可以直接定向到 html 文件的,这样就没走 render
2018-08-31 09:05
@房上的猫 莫非你是直接在浏览器请求的 html, 根本没走 render
2018-08-30 23:12
@nbjgl 在 configPlugin 中的最后,手动调用一下 arp.start() 这样就可以立即启动 ActiveRecordPlugin 了
然后就可以直接 Db.update(...) 了
2018-08-30 22:17
@libofei getModel 得会用,看一下 jfinal demo 中怎么用的,一定要注意前缀:
name="blog.title"
name="blog.content"
上面的 blog 这个前缀,正好是 getModel 第一个参数 “Blog" 的第一个字母变小写,就是 "blog"
你也可以打破上面的约定,手动指定:
getModel(Blog.class, "otherName")
以上就指定了 "otherName" 作为前缀,这个时候,在页面就可以这样:
name="otherName.title"
name="otherName.content"