2010-01-15 6 views
0

부모 관계가 자식 & 인 DB에 테이블이 있습니다. 이제 그래프 (하나의 자식이 여러 부모를 가질 수 있음)로 jsp에서이 정보를 표시하려고합니다.JSP에서 그래프 구조 표시

jsp에서 재귀 호출을 사용해야 할 수도 있습니다. 이런 종류의 일을하는 사람이 있습니까?

예제/포인터?

감사

답변

0

는 계층 구조 목록 /지도 데이터 구조의 조합에 맞게 수 있을까요? 나는 JSP로 보여주기 위해 작업하고있는 계층 적 데이터를 가지고 있지만 레벨이 3 단계 정도이다. Map은리스트의 키 - 값 세트를 가지고 있고리스트는 다른리스트를 가지고있다. 여기에 나의 JSP 코드가있다. 그것은 간단한 일을 계속 표현 langauge과 JSTL 태그를 사용

<section id="content" class="body"> 
    <ol id="posts-list" class="hfeed"> 
     <c:forEach items="${learningEntries}" var="learningEntry"> 
      <li> 
      <table class="wisiEntry"> 
       <tr> 
        <td class="pictureCell"> 
         <img class="wisiEntry-pic" src="${learningEntry.imagePath}" /> 
         <div class="tags"> 
          <c:forEach items="${learningEntry.tags}" var="tag"> 
           <a class="tag" href="/tags/${tag.name}">${tag.name}</a> 
          </c:forEach> 
         </div> 
        </td> 
        <td class="previousNextCell" 
         <div class="wisiEntry-nextSampleButton">Next</div> 
         <div class="wisiEntry-previousSampleButton">Previous</div> 
         <br /> 
         <div class="wisiEntry-addTagButton">Tag</div> 
         <div class="wisiEntry-addCommentButton">Comment</div> 
         <br /> 
         <div class="wisiEntry-uploadButton">Upload</div> 
        </td> 
        <td> 
         <!-- ERROR HAPPENS HERE. Samples should not be null --> 
         <c:forEach items="${learningEntry.samples}" var="sample" varStatus = "status"> 
          <table class="sampleEntry" ${status.first ? '' : 'style = "display:none"'}> 
           <tr> 
            <td class="sampleCell"> 
             <p class="description"> 
              ${sample.description} 
             </p> 
             ... 
+0

고마워요! 내 응용 프로그램에서 나는 '깊이'를 미리 추측 할 수 없다. 지금은 목록에 개체 목록 (P & C 관계 세부 정보 보유)을 생성하지만 모든 구조에 적합 할 수 있어야합니다. –

0

내가 this 당신을 도움이 될 것입니다 생각합니다. 이 JSP 트리는 상위 하위 관계를 매우 잘로드 할 수 있습니다. 나는 Velocity 템플릿과 JSP Tag 클래스를 사용했다. 전체 소스 코드도 사용할 수 있습니다.