我正在創建一個應用程序,我想以嚮導格式將數據添加到窗體中。我將會有一系列模式對話框來逐步完成數據錄入過程。我正在使用Bootstrap模式對話框。我打算將每一步都保存到一個託管bean。應用程序需要在所有設備上工作,這就是爲什麼我這樣做。如何在另一個自定義控件中傳遞和顯示自定義控件
我想創建一個自定義控件來保存模式窗口,然後使用自定義屬性將窗口標題,mainContent,按鈕標題傳遞給控件。窗口標題和按鈕標題正常工作。 「mainContent」屬性包含要在窗口中顯示的自定義控件的XML代碼。我的問題是如何使控件顯示實際的自定義控件內容與自定義控件名稱的XML字符串。我的目標是製作一個可重用的片段。
我試過使用'包含頁面',這使得整個xpage消失。我嘗試過使用'dynamicContent'控件,但一直無法讓它工作。有一個非常明顯的可能性,我沒有正確使用該控件。我把那個代碼留在那裏。旁註:XC:在XPage上的佈局是我的引導程序的佈局,我不認爲在因素
的XPage代碼 - 所有這些都是有調用modalWindow自定義控件:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xc:layout>
<xc:modalWindow button_title="Save and Continue to Step 2"
window_title="Create New PO - Step 1 of 7">
<xc:this.mainContent><![CDATA[<"xc:NewPO_Step1 />"]]></xc:this.body>
</xc:modalWindow>
</xc:layout>
下面是定製控件的代碼 「modalWindow」
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<a href="#myModal" role="button" class="btn" data-toggle="modal">
Begin Creating New PO
</a>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">
×
</button>
<h3 id="myModalLabel">
<xp:text escape="true" id="computedField3"
value="#{javascript:compositeData.window_title}">
</xp:text>
</h3>
</div>
<div class="modal-body">
<xe:dynamicContent id="dynamicContent1"><xp:text escape="true" id="computedField2" value="#{javascript:compositeData.mainContent}">
</xp:text><xp:this.facets>
</xp:this.facets>
</xe:dynamicContent>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">
Cancel
</button>
<button class="btn btn-primary">
<xp:text escape="true" id="computedField4"
value="#{javascript:compositeData.button_title}">
</xp:text>
</button>
</div>
</div>
謝謝你Knut,它的工作原理! – 2013-05-07 19:28:21