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 11:02

不是 bug,你确定在后端能接收到 url 中的这个 '#' 字符?

这个字符出现在 url 之中,进在当前 html 页面中定位的,会滚动你的浏览器滚动条,与后端应该是无关的

2018-08-31 10:10

上面代码中的 redirect("/index.html"); 写错了,应该写成 render(...)

不能写成 redirect

2018-08-31 09:07

@nihaohaaaaa 把你自己的这个 filter 配置在 JFinalFilter 后面,改下 web.xml

2018-08-31 09:05

@房上的猫 莫非你是直接在浏览器请求的 html, 根本没走 render

2018-08-30 23:12

总之就是找准时机就可以了, ActiveRecordPlugin 这类插件是可以手动 start() 的,调用完就启动

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"

2018-08-30 22:03

在 configConstant(Constants me) 中调用就好

2018-08-30 22:01

forwardAction(...) 即可

2018-08-30 21:59

getBean(Blog.class).setCreateTime(new Date()).save() 即可

如果没有生成 getter 方法,则用下面的办法:
getModel(Blog.class).set("createTime", new Date()).save()

2018-08-30 21:18

下载首页的 jfinal demo for maven 这个项目,看里面怎么用的,一看就会

2018-08-30 21:18

看一下是使用的是 jfinal 哪个版本,#(x.userName) 是 jfinal 3.0 以后才有的功能

此外,看一下是不是配置了 me.setViewType(...) 要去掉这个配置

2018-08-30 17:49

乱码问题单步调试一下,看是哪个环节乱的,设置一下即可

关键是单步调试定位