;未找到标签

发布于 2024-10-06 12:25:23 字数 6533 浏览 4 评论 0 原文

我似乎无法去上班。我正在使用冰面和一个非常简单的两列。一个具有删除等操作,另一个具有字符串(表示正则表达式)。为了让删除操作删除右行,我尝试使用以下命令将其链接到实际元素:

<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 服务器实例。是否有一些 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。这没有帮助。所以我四处寻找更多信息。我找到了另一篇与(这个问题)相关的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?

I cant seem to get to work. I am using icefaces and a very simple with two columns. One with actions such as remove and the other with a string (representing a regular expression). In order for the remove action to remove the right row, I am trying to link it to the actual element with an :

<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>

Everything I have found on this says that I need JSF 1.2. I am using JSF 1.2. Here is the apache Ivy config file I am using to manage my dependencies:

<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>

I am using eclipse with IvyDE to manage that library and a Tomcat server instance running with "Use workspace metadata" selected. Is there some eclipse or tomcat thing that might be injecting the wrong version of JSF? When I look at the jsf-impl jar that is included by Ivy, I do see that there are com.sun.faces.taglib.jsf_core.SetPropertyActionListenerImpl and SetPropertyActionListenerTag in that jar. It is my understanding that those should be all that is needed. Any Ideas? Am I missing something, or just plain going crazy?


EDIT:

Now I'm getting really frustrated. Per the suggestion from BalusC I updated my faces-config.xml to use the 1.2 schema definition instead of the 1.1 dtd. This did not help. So I search around for more information. I find another stackoverflow article pertaining to (this issue), however there was no resolution other than getting a new version of jsf-facelets.jar (of which the new/old version is not listed). I am using the latest version available on repo1.maven.org/maven2 (1.1.14). So no go on that front. My new questions are, why would facelets have anything to do with this? Its a part of the JSF core is it not? I notice that in my jsf-impl-1.2_13.jar::META-INF/jsf_core.tld, there is a tag for setPropertyActionListener:

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

On top of that, this can be found in my jsf-facelets-1.1.14.jar::com/sun/facelets/tag/jsf/core/CoreLibrary.java:

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

It looks like my included libraries should be sufficient. Any idea what is going on here? Do I need to go back and get a degree in JSF to be able to write a simple facelet?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

今天小雨转甜 2024-10-13 12:25:23

确保 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。

Ensure that the root declaration of your faces-config.xml is declared as per JSF 1.2 specification.

<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">

Further, the binding="#{binding}" in your datatable really doesn't look right since #{binding} seems to be a managed bean.

自由范儿 2024-10-13 12:25:23

我真的很讨厌回答我自己的问题,尤其是因为这是一个如此简单的错误,但有时我们不得不承认并接受公开的羞辱。不管怎样,长话短说,它:

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

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

希望这会在未来帮助别人......

I really hate to answer my own question, especially since it was such a simple mistake, but sometimes we just have to fess up and accept the public humiliation. Anyway, long story short, its:

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

not

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

Hopefully, this will help someone else in the future...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文