2012-03-09 72 views
0

另一個XHTML這些是從parent.XHTML線,其包括其它(child.xhtml):從控制器傳遞參數到控制器,同時包括一些XHTML成在JSF

parent.xhtml

   <ui:include src="/view/user/includes/child.xhtml"> 

        <ui:param name="passingId" value="#{parentController.myobj.id}"></ui:param> 
       </ui:include> 
      </ui:fragment> 

還有一個childController。 我初始化了myobjparentController@PostConstruct方法。 我想讓childController知道passingId

我試着寫#{childController.setPassingId(parentController.myobj.id)}

但它沒有工作?

有沒有辦法? 感謝

回答

0

有你在hild.xhtml嘗試以下

#{childController.setPassingId(passingId)}

+0

它的工作,但我必須在childController的'@ PostConstruct'中使用它。或者在某個地方喜歡它。但'@ PostConstruct'在'#{childController.setPassingId(passingId)}'運行於xhtml之前。 – merveotesi 2012-03-09 13:19:12

+0

如何使用parentController作爲您的childController @PostConstruct中的託管屬性? – Daniel 2012-03-10 16:29:40

相關問題