2010-12-07 69 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}" /> 

希望这将帮助别人,将来别人...