2010-12-07 68 views
0

我似乎無法開始工作。我正在使用icefaces,並且使用兩列非常簡單。一個用諸如remove之類的動作,另一個用字符串(表示正則表達式)。爲了使刪除操作刪除右排,我試圖將其與鏈接到實際的元素:<f:propertyActionListener>標記未找到

<html xmlns:ice="http://www.icesoft.com/icefaces/component" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:m="http://www.mitre.org/asias/jsf"> 
    <ui:composition> 
    <ice:dataTable binding="#{binding}" 
     value="#{binding.editableRows}" 
     var="item"> 
     <ice:column> 
     <f:facet name="header"> 
      <ice:commandLink styleClass="linkBlue" 
      action="#{binding.addEditableRow}"> 
      <ice:outputText value="Add" /> 
      </ice:commandLink> 
     </f:facet> 
     <ice:commandLink styleClass="linkBlue" 
      action="#{binding.removeEditableRow}"> 
      <f:propertyActionListener value="#{item}" target="#{binding.actionRow}" /> 
      <ice:outputText value="Remove" /> 
     </ice:commandLink> 
     </ice:column> 
     <ice:column> 
     <f:facet name="header"> 
      <ice:outputText value="Regular Expression" /> 
     </f:facet> 
     <ice:inputText value="#{item.object}" size="100" /> 
     </ice:column> 
    </ice:dataTable> 
    </ui:composition> 
</html> 

的一切我已經在這個發現說我需要JSF 1.2。我正在使用JSF 1.2。下面是我使用來管理我的依賴apache的常春藤配置文件:

<ivy-module version="2.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> 

<info organisation="org.mitre.asias" module="testwebproject" /> 

    <configurations defaultconfmapping="default->default"> 
     <conf name="default" visibility="public" description="needed for deployment" extends="runtime,master" /> 
     <conf name="master" visibility="public" description="only this artifact" /> 
     <conf name="runtime" visibility="public" description="libraries only needed at runtime" extends="compile" /> 
     <conf name="provided" visibility="public" description="provided by container, not needed for deployment" /> 
     <conf name="test" visibility="private" description="needed for testing" /> 
     <conf name="compile" visibility="public" description="needed for compilation" /> 
     <conf name="sources" visibility="public" description="the source artifact, if any."/> 
     <conf name="javadoc" visibility="public" description="the javadoc artifact, if any."/> 
     <conf name="optional" visibility="public" description="contains all optional dependencies"/> 
     <conf name="ide" visibility="public" description="all libraries, sources, and javadoc needed for ide" extends="master,compile,provided,test,sources,javadoc" /> 
    </configurations> 

<dependencies> 
     <dependency org="commons-lang" name="commons-lang" rev="2.4" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="log4j" name="log4j" rev="1.2.16" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 

     <dependency org="javax.el" name="el-api" rev="2.1.2-b05" conf="provided->compile(*),provided(*),runtime(*),master(*)" /> 
     <dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="provided->compile(*),provided(*),runtime(*),master(*)" /> 
     <dependency org="javax.servlet" name="jsp-api" rev="2.0" conf="provided->compile(*),provided(*),runtime(*),master(*)" /> 
     <dependency org="org.icefaces" name="icefaces" rev="1.8.2" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="org.icefaces" name="icefaces-comps" rev="1.8.2" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="org.icefaces" name="icefaces-facelets" rev="1.8.2" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="javax.faces" name="jsf-api" rev="1.2_13" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="javax.faces" name="jsf-impl" rev="1.2_13" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 
     <dependency org="com.sun.facelets" name="jsf-facelets" rev="1.1.14" conf="compile->compile(*),master(*);runtime->runtime(*)" /> 

     <dependency org="junit" name="junit" rev="4.8.1" conf="test->default" /> 

     <exclude module="servlet-api" conf="default" /> 
     <exclude module="el-api" conf="default" /> 
     <exclude module="jsp-api" conf="default" /> 
</dependencies> 
</ivy-module> 

我使用與IvyDE日食來管理圖書館,並與選擇「使用工作區的元數據」運行Tomcat服務器實例。有沒有一些eclipse或tomcat的東西可能會注入JSF的錯誤版本?當我查看Ivy包含的jsf-impl jar時,我發現在該jar中有com.sun.faces.taglib.jsf_core.SetPropertyActionListenerImpl和SetPropertyActionListenerTag。我的理解是,這些應該是所有需要的。有任何想法嗎?我錯過了什麼,或者只是簡單地瘋狂?


編輯:

現在,我變得非常沮喪。根據BalusC的建議,我更新了我的faces-config.xml以使用1.2模式定義而不是1.1 dtd。這沒有幫助。所以我搜索了更多信息。我發現另一個與(this issue)有關的stackoverflow文章,但除了獲得新版本的jsf-facelets.jar(其中未列出新版本/舊版本)之外,沒有其他解決方案。我正在使用repo1.maven.org/maven2上的最新版本(1.1.14)。所以不要在那個方面去。我的新問題是,爲什麼facelet與此有關?它是JSF核心的一部分,不是嗎?我注意到,在我的JSF的IMPL-1.2_13.jar :: META-INF/jsf_core.tld,對於setPropertyActionListener標籤:

<tag> 
    ... 
    <name>setPropertyActionListener</name> 
    <tag-class>com.sun.faces.taglib.jsf_core.SetPropertyActionListenerTag</tag-class> 
    <body-content>empty</body-content> 
    ... 
</tag> 

最重要的是,這可以參見我JSF的小面,1.1.14.jar :: COM /陽光/小面/標籤/ JSF /核心/ CoreLibrary.java

... 
this.addTagHandler("setPropertyActionListener", SetPropertyActionListenerHandler.class); 
... 

它看起來像我的圖書館包括應該是足夠了。任何想法發生了什麼?我是否需要返回並獲得JSF的學位才能寫出簡單的facelet?

回答

1

確保您的faces-config.xml的根聲明是按照JSF 1.2規範聲明的。

<faces-config version="1.2" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> 

此外,在你的數據表真的不看,因爲#{binding}binding="#{binding}"似乎是一個託管bean。

+0

我不知道這個關於faces-config版本=「1.2」。我必須等到明天再測試一下,因爲我目前不在代碼前面。至於綁定=「#{binding},我這樣做是因爲這個facelet打算被包含在另一個帶有標記的頁面中,所以這個代碼中的綁定變量指的是那個標籤中定義的那個,謝謝你的迴應,如果它有效的話,我一定會更新它作爲答案。 – Lucas 2010-12-08 02:37:42

+0

另外`xsi:schemaLocation`是不同的。至於綁定,它應該引用` UIComponent`不是託管bean,它真的是'UIComponent`嗎? – BalusC 2010-12-08 02:40:15

1

我真的很討厭回答我自己的問題,特別是因爲這是一個很簡單的錯誤,但有時候我們只好大膽地接受公衆的羞辱。總之,長話短說,它的:

<f:setPropertyActionListener value="#{item}" target="#{binding.actionRow}" /> 

<f:propertyActionListener value="#{item}" target="#{binding.actionRow}" /> 

希望這將幫助別人,將來別人...