x:selectRef 動作用來建立 DBSelect Bean,這個 Bean 會建立在現行頁面的 scriptlet 所能參照的另一頁面中。相關的 Bean 必須已建立在要求或階段作業的範圍內。 在給定的頁面中,每個 DBSelect Bean 只使用這個動作一次。
如果您要參照其他 JSP 動作中的 DBSelect Bean,如 x:getColumn,而不是在 Scriptlet 中,您不需要使用這個動作。
這個動作只是為了方便。 您可以利用標準 jsp:useBean 標示來完成相同的動作,但您必需知道 DBSelect Bean 的類別名稱才能使用該標示,這個標示則沒有這個要求。
<x:selectRef name = "target bean name" />
x:selectRef 元素有下列屬性:
這個範例可出現在頁面的頂端,容許 scriptlet 中會移到 DBSelect Bean 第一列的參照。
<x:selectRef name= "select1" /> <% select1.first() %>