Freemarker Define your own label error (i)

Source: Internet
Author: User

Freemarker Define your own tags


1. Description of the error

Freemarker.core.ParseException:Token manager error:freemarker.core.TokenMgrError:Unknown directive: #macro on line: Column:101, in TEMPLATE:MYSELF.FTL in Myself.ftlat freemarker.template.template.<init> (template.java:174) At Freemarker.cache.TemplateCache.loadTemplate (templatecache.java:447) at Freemarker.cache.TemplateCache.getTemplate (templatecache.java:360) at Freemarker.cache.TemplateCache.getTemplate (templatecache.java:235) at Freemarker.template.Configuration.getTemplate (configuration.java:578) at Freemarker.template.Configuration.getTemplate (configuration.java:543) at Com.you.freemarker.FreemarkerTemplate.getTemplate (freemarkertemplate.java:52) at COM.YOU.FREEMARKER.FREEMARKERTEMPLATE.PRINTFTL (freemarkertemplate.java:76) at Com.you.test.freemarker.FreemarkerTest.studentPrint (freemarkertest.java:217) at Com.you.test.freemarker.FreemarkerTest.testMyself (freemarkertest.java:204) at SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native Method) at Sun.reflect.NativeMethodAccessorImPl.invoke (Unknown source) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown source) at Java.lang.reflect.Method.invoke (Unknown Source) at Org.junit.runners.model.frameworkmethod$1.runreflectivecall ( frameworkmethod.java:45) at Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15) At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:42) at Org.junit.internal.runners.statements.InvokeMethod.evaluate (INVOKEMETHOD.JAVA:20) at Org.junit.internal.runners.statements.RunBefores.evaluate (runbefores.java:28) at Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:263) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:68) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:47) at Org.junit.runners.parentrunner$3.run (parentrunner.java:231) at Org.junit.runners.parentrunner$1.schedule ( PARENTRUNNER.JAVA:60) at Org.junit.runners.ParentRunner.runChildren (parentrunner.java:229) at Org.junit.runners.parentrunner.access$000 (parentrunner.java:50) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:222) at Org.junit.runners.ParentRunner.run (parentrunner.java:300) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUNIT4TESTREFERENCE.JAVA:50) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)

2. Cause of error

<#--freemarker self-defined label-->< #macro write>${repeat ("Zhang Sanfeng", 3)}< #macro >

3, the solution of the method

Made the same mistake again. End tag No seal

<#--freemarker define its own tag-->< #macro write>${repeat ("Zhang Sanfeng", 3)}</#macro >


Freemarker defines its own label error (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.