freemarker中include与import的区别
来源:互联网 发布:淘宝链接e22a 编辑:程序博客网 时间:2024/04/30 14:18
问题显示:
在inc1.ftl与inc2.ftl中的内容分别是:
<#assign username="刘德华">与<#assign username="张学友">
接着我在hello.ftl模版中用include将inc1.ftl包含进来
<#include "/inc/inc1.ftl">
${username}
此刻获取的结果是:刘德华
接着我们在hello.ftl用include将inc1.ftl与inc2.ftl同时进行包含进来
<#include "/inc/inc1.ftl">
<#include "/inc/inc2.ftl">
${username}
此刻获取的值是:张学友
总结:出现这种情况,在两个模版中都分别存在变量名都相同的变量的时候,include包含进来,会进行覆盖,include只时候将其公共的静态文件进行包含,而里面不涉及到内部函数以及变量声明之类的,当涉及到这种问题,我们就要用import进行导入
1 0
- freemarker中include与import的区别
- freemarker中include与import的区别
- freemarker中include与import的区别
- freemarker中include与import的区别
- JAVA Freemarker(8)--中include与import的区别
- freemarker include与import的区别, 宏marco的使用
- FreeMarker中<#include>和<#import>标签的区别
- FreeMarker中<#include>和<#import>标签的区别
- FreeMarker中<#include>和<#import>标签的区别
- FreeMarker中<#include>和<#import>标签的区别
- schema中import与include的区别
- schema中import与include的区别
- #include与import的区别
- #include与#import的区别,#import 与@class 的区别
- #import 与#include区别
- #import 与 #include的区别,以及 @class
- #import 与 #include的区别,以及 @class
- #include、#import与@class的区别
- 棋牌游戏服务器架构: 详细设计(三) 数据库设计
- poj1079 2010.2.17
- IList和List的 区别
- [Leetcode]149. Max Points on a Line @python
- 如何将 .net2.0注册到IIS ,重新注册IIS
- freemarker中include与import的区别
- db2 runstates
- [转] 金山CEO求伯君今退休 老一代程序员时代结束
- oracle 创建数据库时 Enterprise Manager 配置失败
- virtualenv的AssertionError: Filename C:\Python27\Lib\os.py does not start with any of these pref的一些办法
- Android开发笔记(五十六)摄像头拍照
- 懒汉式饿汉式
- HDU 1018 big numbe
- 利用Delphi编写Socket通信程序