忏愧,enjoy出来这么久,一直没用上,最近新项目用上3.3版本,这里有一问题,
想用模板生成一个html字符串用来发送邮件。我用demo测试如下:
String html=Engine.use().getTemplate("blog.html").toString();
尽报错,什么原因,
File not found : null/blog.html
这个null是哪里来的?找不到这个blog.html模板文件?
[ERROR]-[Thread: qtp24933899-21]-[com.jfinal.core.ActionHandler.handle()]: /blog java.lang.RuntimeException: File not found : null/blog.html at com.jfinal.template.source.FileSource.getContent(FileSource.java:70) at com.jfinal.template.Engine.buildTemplateBySourceFactory(Engine.java:153) at com.jfinal.template.Engine.getTemplate(Engine.java:138) at com.demo.blog.BlogController.index(BlogController.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.jfinal.aop.Invocation.invoke(Invocation.java:73) at com.demo.blog.BlogInterceptor.intercept(BlogInterceptor.java:17) at com.jfinal.aop.Invocation.invoke(Invocation.java:67) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:83) at com.demo.common.MyContextPathHandler.handle(MyContextPathHandler.java:37) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:365) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
项目:JFinal
最后,建议用 jfinal 3.4版本,过几天发布 3.5 版本极速升级一下