我似乎无法上班。我正在使用 icefaces 和一个非常简单的两列。一个带有诸如删除之类的操作,另一个带有字符串(表示正则表达式)。为了使删除操作删除正确的行,我试图将其链接到实际元素:
<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 配置文件:
<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>
我正在使用 eclipse 和 IvyDE 来管理该库和一个运行选择了“使用工作区元数据”的 Tomcat 服务器实例。是否有一些可能会注入错误版本的 JSF 的 eclipse 或 tomcat 东西?当我查看 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 ) 上提供的最新版本。所以不要走那条战线。我的新问题是,为什么 facelets 与此有关?它不是 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-facelets-1.1.14.jar::com/sun/facelets/tag/jsf/core/CoreLibrary.java 中找到:
...
this.addTagHandler("setPropertyActionListener", SetPropertyActionListenerHandler.class);
...
看起来我包含的库应该足够了。知道这里发生了什么吗?我是否需要返回并获得 JSF 学位才能编写简单的 facelet?