主题 : action_cms.ftl模板里@s.action 是哪里来的以及双问号 |
级别: 秀才
![]() |
1# 发表于:2010-04-08 16:23:15 IP:124.50.*.*
|
||||
---|---|---|---|---|---|
级别: 童生
![]() |
2# 发表于:2010-05-15 10:47:18 IP:119.212.*.*
1、在action_cms.ftl模板里@s.action 是哪里来的?
<@s.action name='ChnlList' namespace='/jeecms/tag/cms' executeResult='true'。。。 和 <#else> <@s.action name='ChnlListInner' namespace='/jeecms/tag/cms' executeResult='false'。。。 这里的s 是从哪里定义来的? A: 这个是在freemarker.properties中的auto_import属性。 2、 <#local customs = ' '> <#list custom as s> <#local customs = customs+s> <#if s_has_next><#local customs = customs+'|'></#if> </#list> 请说明上面语法local和此段代码的意思 A: local是定义变量,上边的代码相当于没有运行。因为customs='',里面的s_has_next就是系统自带的和java中的s.next()相当。 3、common_tag.ftl里<#if c.parent??>双问号是怎么个意思啊? A: 双问号的意思就是是否为空。if (c.parent == null)相当。 |
||
---|---|---|---|
级别: 白丁
![]() |
3# 发表于:2010-06-10 22:34:09 IP:60.200.*.*
楼上的回答有误,更正一下:
1,"s"是定义在struts-default.xml中的 <bean type="org.apache.struts2.views.TagLibrary" name="s" class="org.apache.struts2.views.DefaultTagLibrary" /> 具体的话看看Struts2和freemaker的关系吧 freemarker.properties中定义的auto_import是p和cms 2,local是定义变量 具体可以参考 http://freemarker.sourceforge.net/docs/dgui_misc_var.html 你提供的这段代码的作用是把custom散列中的数据中间加上"|" 后赋给变量customs 例如: custom=['国内','国际','全部'] 那么customs ="国内|国际|全部" 3,判断是否为空 http://freemarker.sourceforge.net/docs/dgui_template_exp.html#dgui_template_exp_missing_test |
||
---|---|---|---|
1
共1页