freemarker自定义标签
假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html
1、错误描述
1 freemarker.core.ParseException: Unexpected end of file reached.
2
3 at freemarker.core.FMParser.generateParseException(FMParser.java:4702)
4 at freemarker.core.FMParser.jj_consume_token(FMParser.java:4573)
5 at freemarker.core.FMParser.UnifiedMacroTransform(FMParser.java:1978)
6 at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2404)
7 at freemarker.core.FMParser.Content(FMParser.java:2623)
8 at freemarker.core.FMParser.OptionalBlock(FMParser.java:2791)
9 at freemarker.core.FMParser.Root(FMParser.java:2963)
10 at freemarker.template.Template.<init>(Template.java:171)
11 at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:447)
12 at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:360)
13 at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235)
14 at freemarker.template.Configuration.getTemplate(Configuration.java:578)
15 at freemarker.template.Configuration.getTemplate(Configuration.java:543)
16 at com.you.freemarker.FreemarkerTemplate.getTemplate(FreemarkerTemplate.java:52)
17 at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:76)
18 at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:217)
19 at com.you.test.freemarker.FreemarkerTest.testMyself(FreemarkerTest.java:204)
20 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
21 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
22 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
23 at java.lang.reflect.Method.invoke(Unknown Source)
24 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
25 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
26 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
27 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
28 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
29 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
30 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
31 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
32 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
33 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
34 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
35 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
36 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
37 at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
38 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
39 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
40 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
41 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
42 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
43 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
2、错误原因
1 <html>
2 <head>
3 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
4 <title>freemarker自定义标签</title>
5
6 </head>
7
8 <body>
9 <#--freemarker自定义标签-->
10 <#macro write>
11 repeat("张三丰",3)
12 </#macro>
13
14 <@write>
15 </body>
16 </html>
<@write>缺少关闭符号
3、解决办法
将“<@write>”改为“<@write/>”
假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)