<#include> vs <#import> in FreeMarker
2017-11-28 20:21
267 查看
<#include> 就好比将目标文件内容拷贝输出到<#include>标签所在位置,而<#import>也用以处理加载目标文件,但却不输出任何内容,相反它只是导入由目标模板创建的变量集(名称空间),并将其分配给as后面的keyword变量。至于目标文件中创建的宏和函数,<#import>操作也只是创建变量以供模板引用,<#import>可用于提取实用宏和函数的集合。另外,注意:如果<#import>一个文件两次,那么第二次将不做任何操作,因为目标模板中定义的命名空间已经引入到了当前模板中,但如果你在当前模板中调用<#include>两次,那么引擎会处理加载两次目标模板。
至于目标模板中涉及的JavaScript,因为FreeMarker是运行在服务器端的,而JavaScript是运行在客户端浏览器中的,所以浏览器最终看到的是FreeMarker的最终输出。
https://stackoverflow.com/questions/35740969/freemarker-difference-between-include-and-import
至于目标模板中涉及的JavaScript,因为FreeMarker是运行在服务器端的,而JavaScript是运行在客户端浏览器中的,所以浏览器最终看到的是FreeMarker的最终输出。
https://stackoverflow.com/questions/35740969/freemarker-difference-between-include-and-import
相关文章推荐
- Traceback (most recent call last): File "test.py", line 2, in <module> import pandas ImportErr 原创 20
- vs未找到导入的项目,请确认 <Import> 声明中的路径正确
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- objective c:import和include的区别, ""和<>区别
- 在VS中使用#include <bits/stdc++.h>的方法
- include指令和include动作以及<c:import>总结
- <html> vs. <body> element in css
- You must specifiy a layout in the include tag: <include layout="@layout/layoutID" />
- #include <filename> VS #include "filename"
- 为什么在vs 中用include<iostream.h>不行,而include<stdio.h>可用
- vs 2017 include<Pthread.h>无法打开源文件
- 为什么在vs 中用include<iostream.h>不行,而include<stdio.h>可用
- Linux C/C++ ------ “” and <> in the use of head include file(Pending Verification)
- compilation terminated. In file included from <command-line>:0:0: /usr/include/stdc-predef.h:30:26:
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
- mac编译PHP报错 configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
- FreeMarker中<#include>和<#import>标签的区别
- Unity_ GetComponentsInChildren<T>(Bool includeInactive) 获取自己和它的孩子有同样的组件
- configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/