2012-07-17 52 views
0
<cfparam name="attributes.mytestvalue" default="0"> 
<cfdump var="#attributes#"> 

<!--- Attributes are there. ---> 

<cfdocumentSection> 
    <cfdocumentitem type="footer"> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

<!--- Attributes are not there. ---> 

为什么会发生这种情况?这是一个已知的错误?<cfdocumentItem>中缺少的属性>

回答

2

据\ WEB-INF \ cftags \ META-INF \ taglib.cftld,cfdocumentsection和cfdocumentitem实施为定制标签本身,因此可能有自己的属性范围,从而掩盖你投入属性范围值。

你可以试试这个:

<cfdocumentSection> 
    <cfdocumentitem type="footer" mytestvalue="#attributes.myTestValue#> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

或许这样的:

<cfset attribs={type="footer", myTestValue=0}> 
<cfdocumentSection> 
    <cfdocumentitem attributeCollection="#attribs#"> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem> 
</cfdocumentSection> 

而且,虽然我不认为这是这里的问题,你已经得到了TYPE = “页脚”属性上cfdocumentItem的结束标记,这是没有必要的

+0

对不起,type =“footer”是剪切粘贴错误,因为实际代码位于不同的系统上。 – 2012-07-17 14:23:41

0
<cfset request.myTestValue=attributes.myTestValue> 

<cfdocumentSection> 
    <cfdocumentitem type="footer" mytestvalue="#request.myTestValue#> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

这个固定不过现在我知道为什么它不干活G。谢谢Barnyr。