1、错误描述
假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html
1 六月 25, 2014 11:32:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 2 严重: Template processing error: "Macro select has no such argument: name" 3 4 Macro select has no such argument: name 5 The problematic instruction: 6 ---------- 7 ==> macro select [on line 1, column 1 in inc/select.ftl] 8 in user-directive items.select [on line 10, column 6 in address.ftl] 9 ---------- 10 11 Java backtrace for programmers: 12 ---------- 13 freemarker.template.TemplateException: Macro select has no such argument: name 14 at freemarker.core.Environment.visit(Environment.java:576) 15 at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) 16 at freemarker.core.Environment.visit(Environment.java:221) 17 at freemarker.core.MixedContent.accept(MixedContent.java:92) 18 at freemarker.core.Environment.visit(Environment.java:221) 19 at freemarker.core.Environment.process(Environment.java:199) 20 at freemarker.template.Template.process(Template.java:259) 21 at com.you.freemarker.FreemarkerTemplate.printFile(FreemarkerTemplate.java:109) 22 at com.you.test.freemarker.FreemarkerTest.studentFile(FreemarkerTest.java:260) 23 at com.you.test.freemarker.FreemarkerTest.testSelect(FreemarkerTest.java:233) 24 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 25 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 26 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 27 at java.lang.reflect.Method.invoke(Unknown Source) 28 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) 29 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 30 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) 31 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) 32 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) 33 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) 34 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) 35 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) 36 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) 37 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) 38 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) 39 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) 40 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) 41 at org.junit.runners.ParentRunner.run(ParentRunner.java:300) 42 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 43 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 44 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 45 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 46 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 47 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 48 49 50 Macro select has no such argument: name 51 The problematic instruction: 52 ---------- 53 ==> macro select [on line 1, column 1 in inc/select.ftl] 54 in user-directive items.select [on line 10, column 6 in address.ftl] 55 ---------- 56 57 Java backtrace for programmers: 58 ---------- 59 freemarker.template.TemplateException: Macro select has no such argument: name 60 at freemarker.core.Environment.visit(Environment.java:576) 61 at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) 62 at freemarker.core.Environment.visit(Environment.java:221) 63 at freemarker.core.MixedContent.accept(MixedContent.java:92) 64 at freemarker.core.Environment.visit(Environment.java:221) 65 at freemarker.core.Environment.process(Environment.java:199) 66 at freemarker.template.Template.process(Template.java:259) 67 at com.you.freemarker.FreemarkerTemplate.printFile(FreemarkerTemplate.java:109) 68 at com.you.test.freemarker.FreemarkerTest.studentFile(FreemarkerTest.java:260) 69 at com.you.test.freemarker.FreemarkerTest.testSelect(FreemarkerTest.java:233) 70 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 71 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 72 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 73 at java.lang.reflect.Method.invoke(Unknown Source) 74 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) 75 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 76 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) 77 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) 78 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) 79 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) 80 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) 81 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) 82 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) 83 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) 84 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) 85 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) 86 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) 87 at org.junit.runners.ParentRunner.run(ParentRunner.java:300) 88 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 89 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 90 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 91 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 92 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 93 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
2、错误原因
由于select定义中没有name属性<#macro select id>,但是在引用时出现name属性
<@items.select id="city" name="city"/>,导致出现错误
3、解决办法
在引用时,删掉name属性
<@items.select id="city"/>