2012-05-22 17 views
1

我有一個綜合的Facelets組件,其中包括,除其他事項外,將一個命令:爲什麼在我的Facelets複合組件中,「cc」在commandButton的action中是null?

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html> 
<ui:component xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:cc="http://java.sun.com/jsf/composite" 
      xmlns:ice="http://www.icesoft.com/icefaces/component" 
      xmlns:nc="http://compositecomps.sss.evla.nrao.edu/jsf" 
      xmlns:opt="http://java.sun.com/jsf/composite/components/opt" 
      xmlns:undo="http://undo.sss.evla.nrao.edu/jsf" 
      xmlns:n="http://sss.evla.nrao.edu/jsf" 
      xmlns:f="http://java.sun.com/jsf/core"> 
<cc:interface> 
    <cc:attribute name="value" type="edu.nrao.sss.tools.obsprep.bulkedit.BulkEditor"      required="true"/> 
    <cc:attribute name="loop" type="edu.nrao.sss.tools.obsprep.uiactions.project.scan.ScanLoopUIActions" required="true"/> 
</cc:interface> 

<cc:implementation> 
    <ui:param name="loop" value="#{cc.attrs.loop}"/> 
    <ui:param name="val" value="#{cc.attrs.value}"/> 

    <ice:panelGroup id="wizStep1" 
        rendered="#{val.readyToSelect}"> 
    <nc:header value="select fields to filter on"/> 
    <ice:commandButton value="#{val.nameField.value}" action="#{val.select}"/> 
    <table cellpadding="5"> 
     <thead> 
     <tr> 
      <th></th><th>Field</th><th>Search For</th><th></th> 
     </tr> 
     </thead> 
     <tbody> 
     <opt:bulkEditField value="#{val.nameField}"> 
      <f:facet name="summary"> 
      <ice:inputText value="#{val.nameField.value}"/> 
      </f:facet> 
     </opt:bulkEditField> 
     </tbody> 
    </table> 
    <ice:commandButton value="Select" action="#{val.select}"/> 
    </ice:panelGroup> 
</cc:implementation> 
</ui:component> 

我已經改變使用val.nameField.value作爲標籤的第一個命令按鈕來演示該問題的代碼。

當我在頁面中使用此組件時,它呈現按鈕和它下面的可搜索字段列表。如果我更改名稱字段的值,按鈕標籤將更改。

但是,如果我按一下按鈕,我得到一個目標不可達的異常:

Caused by: javax.el.PropertyNotFoundException: /resources/components /opt/bulkEdit.xhtml @25,79 action="#{val.select}": Target Unreachable, identifier 'val' resolved to null 

我覺得我必須缺少一些基本的東西如何看待這些複合材料部件的工作。這可以在facelets/JSF 1.2下正常工作。在升級到JSF 2.0的過程中,我想繼續使用複合組件,以便可以定義一個接口。

如果我停止使用<ui:param/>並直接放入cc.attrs.value,它告訴我cc爲空。

我認爲這可能是一個冰塊中的錯誤,但切換到普通<h:commandButton/>做同樣的事情。

感謝您的任何建議。

回答

相關問題