JSF Trinidad 树组件无法扩展

发布于 2024-11-03 12:55:56 字数 4961 浏览 0 评论 0原文

我使用 JSF Mojarra 2.0.3 实现以及 Apache Trinidad 2.0.0 beta 框架,以便我可以使用树组件。

我遵循有关树组件的开发人员指南以及 Oracle ADF < a href="http://www.slideshare.net/mwessendorf/trinidad-in-action" rel="nofollow">教程,但我还没有成功重现Oracle示例。

树组件被渲染,但它不会展开/折叠。我只能看到根元素。

使用 apache 演示树组件,我已经注意到页面没有重新加载。看来是ajax管理的。

所以我认为我的问题是我将树组件放入了表单 JSF 标签中。无论如何,如果我不将树组件放入 ah:form 标记中,则不会渲染树组件。

将树组件嵌入到表单中后,我还注意到,当我尝试从树中展开节点时,整个页面都会重新加载。这可以解释为什么树没有扩展。

有人知道特立尼达树组件的线索吗?

顺便说一句,树组件是我使用的唯一 Trinidad 组件。我不知道这是否与 JSF Mojarra 的实现默认组件存在某种不兼容。

还是不行。使用根元素渲染的树,但用鼠标单击时它们不会展开。现在最终的 html 文档中只有一个 and 标签。这里是我的xhtml:

header.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <div id="header" class="header">
        <div id="header_title">
            <p>#{msg.app_title}</p>
        </div>
        <div id="clear"/>
    </div>

</ui:composition>

footer.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets">

            <div id="footer" class="footer">#{msg.app_footer}</div>

</ui:composition>

template.xhtml:

<tr:document xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:tr="http://myfaces.apache.org/trinidad"
      title="#{msg.app_title}">

    <div id="header">
        <ui:include src="/WEB-INF/templates/header.xhtml"/>
    </div>

    <center>
    <div id="content">
      <ui:insert name="content">
      </ui:insert>
    </div>
    </center>

    <div id="footer">
        <ui:include src="/WEB-INF/templates/footer.xhtml"/>
    </div>
</tr:document>

login.xhtml:

<ui:composition template="/WEB-INF/templates/template.xhtml"
                        xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:h="http://java.sun.com/jsf/html"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:tr="http://myfaces.apache.org/trinidad">

    <ui:define name="content">
        <tr:form id="login_form">
            <h:panelGrid columns="3">
                <h:outputText value="#{msg.username}"></h:outputText>
                <h:inputText id="username" value="#{loginBean.username}" required="true"/>
                <h:message for="username" class="error_message"/>

                <h:outputText value="#{msg.password}"></h:outputText>
                <h:inputSecret id="password" value="#{loginBean.password}" required="true">
                    <f:validator validatorId="checkUserValidator"/>
                    <f:attribute name="usernameId" value="username"/>
                </h:inputSecret>

                <h:message for="password" class="error_message"/>
            </h:panelGrid>
           <h:commandButton value="#{msg.login}" action="#{loginBean.checkUser}"/>

           <tr:panelBox background="transparent">        
                <tr:tree var="menu" value="#{testTree.tree}">
                    <f:facet name="nodeStamp">
                        <tr:goLink text="#{menu.name}"/>
                    </f:facet>
                </tr:tree>
              </tr:panelBox>

        </tr:form>
        <h:outputLink value="/MyApp/faces/newAccount.xhtml">
            <h:outputText value="#{msg.create_account}"></h:outputText>
        </h:outputLink>
    </ui:define>
</ui:composition>

TestTree.java:

public class TestTree{

private TreeModel tree;


public TestTree(){

    Person john = new Person("John Smith");
    Person kim = new Person("Kim Smith");
    Person tom = new Person("Tom Smith");
    Person ira = new Person("Ira Wickrememsinghe");
    Person mallika = new Person("Mallika Wickremesinghe");

    john.getKids().add(kim);
    john.getKids().add(tom);
    ira.getKids().add(mallika);

    // create the list of root nodes:
    List people = new ArrayList();
    people.add(john);
    people.add(ira);

    tree = new ChildPropertyTreeModel(people, "kids");
}

public TreeModel getTree(){
    return tree;
}

public void setTree(TreeModel tree){
    this.tree = tree;
}

}


使用这种情况的另一个问题是,我应该在哪里指定我的css文件?我没有找到文档标签的任何属性。我如何访问特立尼达生成的标签?

I'm using JSF Mojarra 2.0.3 implementation along with Apache Trinidad 2.0.0 beta framework, so that I can use tree component.

I've followed developers guide regarding tree component, as well as the Oracle ADF tutorial, but I haven't succeded in reproducing the Oracle example.

Tree component gets rendered, but it doesn't expand/collapse. I only can see the root elements.

Playing with the apache demo tree component, I've noticed that the page is not reloaded. It seems to be ajax managed.

So I think my problem is that I have my tree component into a form JSF tag. Anyway, if I don't place the tree component into a h:form tag, the tree component is not rendered.

Having the tree component embeded into a form, I have also noticed that when I try to expand a node from the tree, the whole page reloads. It may explain why the tree is not expanding.

Anyone has a clue about Trinidad tree component?

By the way, tree component is the only Trinidad component I'm using. I don't know if it is some sort of incompatibility with JSF Mojarra's implementation default components.

Still doesn't work. Tree rendered with root elements, but they don't expand when clicking with mouse. Now only one and tags in the final html document. Here my xhtml's:

header.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <div id="header" class="header">
        <div id="header_title">
            <p>#{msg.app_title}</p>
        </div>
        <div id="clear"/>
    </div>

</ui:composition>

footer.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets">

            <div id="footer" class="footer">#{msg.app_footer}</div>

</ui:composition>

template.xhtml:

<tr:document xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:tr="http://myfaces.apache.org/trinidad"
      title="#{msg.app_title}">

    <div id="header">
        <ui:include src="/WEB-INF/templates/header.xhtml"/>
    </div>

    <center>
    <div id="content">
      <ui:insert name="content">
      </ui:insert>
    </div>
    </center>

    <div id="footer">
        <ui:include src="/WEB-INF/templates/footer.xhtml"/>
    </div>
</tr:document>

login.xhtml:

<ui:composition template="/WEB-INF/templates/template.xhtml"
                        xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:h="http://java.sun.com/jsf/html"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:tr="http://myfaces.apache.org/trinidad">

    <ui:define name="content">
        <tr:form id="login_form">
            <h:panelGrid columns="3">
                <h:outputText value="#{msg.username}"></h:outputText>
                <h:inputText id="username" value="#{loginBean.username}" required="true"/>
                <h:message for="username" class="error_message"/>

                <h:outputText value="#{msg.password}"></h:outputText>
                <h:inputSecret id="password" value="#{loginBean.password}" required="true">
                    <f:validator validatorId="checkUserValidator"/>
                    <f:attribute name="usernameId" value="username"/>
                </h:inputSecret>

                <h:message for="password" class="error_message"/>
            </h:panelGrid>
           <h:commandButton value="#{msg.login}" action="#{loginBean.checkUser}"/>

           <tr:panelBox background="transparent">        
                <tr:tree var="menu" value="#{testTree.tree}">
                    <f:facet name="nodeStamp">
                        <tr:goLink text="#{menu.name}"/>
                    </f:facet>
                </tr:tree>
              </tr:panelBox>

        </tr:form>
        <h:outputLink value="/MyApp/faces/newAccount.xhtml">
            <h:outputText value="#{msg.create_account}"></h:outputText>
        </h:outputLink>
    </ui:define>
</ui:composition>

TestTree.java:

public class TestTree{

private TreeModel tree;


public TestTree(){

    Person john = new Person("John Smith");
    Person kim = new Person("Kim Smith");
    Person tom = new Person("Tom Smith");
    Person ira = new Person("Ira Wickrememsinghe");
    Person mallika = new Person("Mallika Wickremesinghe");

    john.getKids().add(kim);
    john.getKids().add(tom);
    ira.getKids().add(mallika);

    // create the list of root nodes:
    List people = new ArrayList();
    people.add(john);
    people.add(ira);

    tree = new ChildPropertyTreeModel(people, "kids");
}

public TreeModel getTree(){
    return tree;
}

public void setTree(TreeModel tree){
    this.tree = tree;
}

}


Another question by using this case, where should I specify my css file? I haven't found any attribute for document tag. How can I access and tags generated by Trinidad?

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

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

发布评论

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

评论(1

匿名的好友 2024-11-10 12:55:56

我在 jsf1.2 上使用 trinidad 树组件(trinidad 1.2.14)没有任何问题。我不知道 trinidad 如何与 mojarra 实现一起工作。

我的网站看起来像这样,如 标签文档 中所述

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<f:view>

<tr:document>
<tr:form id="frmMain">
  <tr:panelBox background="transparent">        
    <tr:tree var="menu" value="#{myBean.model}">
        <f:facet name="nodeStamp">
            <tr:goLink 
                text="#{menu.label}" 
                destination="#{menu.address}"
                targetFrame="Data"/>
        </f:facet>
    </tr:tree>
  </tr:panelBox>
</tr:form>
</tr:document>
</f:view>

这可能可以帮助您缩小问题范围。

I am using the trinidad tree component (trinidad 1.2.14) on jsf1.2 without any problems. I don't know how trinidad works together with the mojarra implementation.

My site look like this, as described in Tag Documentation :

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<f:view>

<tr:document>
<tr:form id="frmMain">
  <tr:panelBox background="transparent">        
    <tr:tree var="menu" value="#{myBean.model}">
        <f:facet name="nodeStamp">
            <tr:goLink 
                text="#{menu.label}" 
                destination="#{menu.address}"
                targetFrame="Data"/>
        </f:facet>
    </tr:tree>
  </tr:panelBox>
</tr:form>
</tr:document>
</f:view>

Probably this helps you to narrow the problem.

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