2011-04-26 5 views
0

저는 트리 구성 요소를 사용할 수 있도록 Apache Trinidad 2.0.0 베타 프레임 워크와 함께 JSF Mojarra 2.0.3 구현을 사용하고 있습니다.JSF 트리니다 드 트리 구성 요소가 확장되지 않습니다

오라클 ADF tutorial뿐 아니라 트리 구성 요소에 대해서도 developers guide을 따라 왔지만 오라클 예제를 재 작성하지 않았습니다.

트리 구성 요소가 렌더링되지만 확장/축소되지 않습니다. 나는 오직 루트 요소를 볼 수 있습니다.

apache demo tree component으로 재생하면 페이지가 다시로드되지 않은 것으로 나타났습니다. 그것은 아약스 관리 것으로 보인다.

제 생각에는 제 나무 구성 요소가 양식 JSF 태그에 있다고 생각합니다. 어쨌든 h : form 태그에 트리 구성 요소를 배치하지 않으면 트리 구성 요소가 렌더링되지 않습니다.

트리 구성 요소가 양식에 임베드되어 있으면 트리에서 노드를 확장하려고 할 때 전체 페이지가 다시로드된다는 사실을 눈치 챘습니다. 왜 나무가 팽창하지 않는지 설명 할 수 있습니다.

누구나 트리니다 드 트리 구성 요소에 대한 단서가 있습니까?

그런데 트리 구성 요소는 내가 사용하고있는 유일한 트리니다 드 구성 요소입니다. JSF Mojarra의 구현 기본 컴포넌트와 일종의 비호 환성인지 여부는 알 수 없습니다.

여전히 작동하지 않습니다. 트리는 루트 요소로 렌더링되지만 마우스로 클릭하면 확장되지 않습니다. 이제 최종 html 문서에서 하나와 태그 만 있습니다. 여기 내 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 :

공용 클래스 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 파일을 지정해야합니까? 문서 태그에 대한 속성을 찾지 못했습니다. Trinidad에서 생성 한 태그 및 액세스하려면 어떻게해야합니까?

답변

0

jsf1.2에서 trinidad 트리 구성 요소 (trinidad 1.2.14)를 사용해도 문제가 없습니다. 트리니다 드가 mojarra 구현과 함께 어떻게 작동하는지 모르겠습니다.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> 

은 아마이 문제를 좁히는 데 도움이됩니다.

+0

본문 및 HTML 태그를 어떻게 지정했는지 말씀해 주시겠습니까? " 및 "으로 지정했습니다. 문제가 될 수 있습니까? 요점은 다른 JSF 튜토리얼에 따라, 나는 항상 ""태그 대신에 이러한 태그를 사용한다는 것을 알 수있다. – David

+0

안녕하세요 저는 제 대답을 편집했습니다. 이것은 내 페이지의 전체 코드입니다. 트리니 다드의 태그는 을 생성합니다. tr : document에 대해서는 Trinidad Tag 설명서를 참조하십시오. 예, 아마도 이것이 당신의 문제입니다. 트리니다 드 재료 만 들어있는 간단한 페이지를보고 나무가 예상대로 작동하는지 확인하십시오. – lkdg

+0

나는 당신의 모범을 이해하지 못합니다. 나는 그것이 표준 xhtml 웹 페이지가 아닌 것 같은가요? 내 css 및 javascript 리소스는 어디에서 정의 할 수 있습니까? 이 작업에 적합한 문서 속성을 보지 못했습니다. – David

관련 문제