2018-07-31 15:42
@jfinalcloud 原因是pjax的form提交(post)是文件方式,get方式没问题。解决方法有2个:1、controller中的方法中先调用getFile()方法即可获得(不推荐);2、Pjax我只做跳转,提交form还是使用ajaxForm来做。
2018-07-18 21:22
@JFinal 模板文件修改都搞定了。也setBaseModelTemplate了,_generator执行到generate()方法时,总是报错:
Base Model Output Dir: D:\javaProjects\idea\dlhr/src/main/java/ltd/dinglan/hr/common/model/base
Exception in thread "main" java.lang.IllegalArgumentException: File not found : "ltd/dinglan/hr/common/model/ext/base_model_template.jf"
Disconnected from the target VM, address: '127.0.0.1:54674', transport: 'socket'
at com.jfinal.template.source.ClassPathSource.(ClassPathSource.java:68)
at com.jfinal.template.source.ClassPathSourceFactory.getSource(ClassPathSourceFactory.java:29)
at com.jfinal.template.Engine.buildTemplateBySourceFactory(Engine.java:152)
at com.jfinal.template.Engine.getTemplate(Engine.java:139)
at com.jfinal.plugin.activerecord.generator.BaseModelGenerator.genBaseModelContent(BaseModelGenerator.java:112)
at com.jfinal.plugin.activerecord.generator.BaseModelGenerator.generate(BaseModelGenerator.java:102)
at com.jfinal.plugin.activerecord.generator.Generator.generate(Generator.java:268)
at ltd.dinglan.hr.common.model._Generator.main(_Generator.java:92)
Process finished with exit code 1
跟踪了代码,换回之前的路径“/com/jfinal/plugin/activerecord/generator/base_model_template.jf”就不会出错。我的路径写了好几种写法:ltd/dinglan/hr/common/model/ext/base_model_template.jf、/ltd/dinglan/hr/common/model/ext/base_model_template.jf、/src/main/java/ltd/dinglan/hr/common/model/ext/base_model_template.jf、以及全路径都不行。正调试中……
2018-06-15 13:31
按照James的提示:
方法中没有加getFile之前:
JFinal-3.4 action report -------- 2018-06-15 10:14:25 --------------------------
Url : GET /employee/update
Controller : xxx.EmployeeCtroller.(EmployeeCtroller.java:1)
Method : update
Interceptor : xxx.interceptor.LoginSessionInterceptor.(LoginSessionInterceptor.java:1)
xxx.admin.common.PjaxInterceptor.(PjaxInterceptor.java:1)
Parameter : id=28 _pjax=#pjax-tab0
--------------------------------------------------------------------------------
方法中加入getFile之后:
JFinal-3.4 action report -------- 2018-06-15 10:14:28 --------------------------
Url : POST /employee/save
Controller : xxx.employee.EmployeeCtroller.(EmployeeCtroller.java:1)
Method : save
Interceptor : xxx,.common.interceptor.LoginSessionInterceptor.(LoginSessionInterceptor.java:1)
xxx._admin.common.PjaxInterceptor.(PjaxInterceptor.java:1)
Parameter : companyId=123 name=1ffff sex=1 code=100 id=28