You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Christian Heine <He...@gmx.de> on 2002/12/03 16:38:28 UTC

Inner loops in Velocity?

Hi all,

i've tryed to develop a Velocity-Portlet to request information from a
database. From the database i read out different informations in differend
requests. My task is to develop a data tree like the Explorer, and at this point i
have the following problem:

At first i read out the main informations (Project datas) which i present in
a HTML-Table by an foreach-Loop. One of these Projects could be selected, is
this true, i must insert at this positon another loop to represent possible
subdatas like in this way :

#set($projects = $dbRequest.getProjects())
#set($sproject = $dbRequest.getSelectetProject())

#if(!$sproject)
       $dbRequest.setSelectedproject($projets.get(0))
       #set($sproject = $dbRequet.getSelectedProject())
#end

<table>
#foreach($project in projects)
<tr>
      #if($project == $sproject)
      <td>
             <IMG src="d:\icons\openfolder.jpg" border="0">
      <td>
      <td> $project </td>
      
      #else
      <td>
             <IMG src="d:\icons\folder.jpg" border="0">
      <td>
      <td> $project </td>
      #end
</tr>

Up to this point all works fine, now i try to implement an inner loop to
consider the representation of the subprojets. For that i start an other request
and set up an other loop :

#if($project == $sproject)
     #set($subprojects = dbRequest.getSubProjects($project))

     #foreach($subproject in $subprojects)
     <tr>
         <td>&nbsp;</td>
         <td><IMG src="folder.gif" border="0">
         <td>$subproject</td>
     </tr>
     #end  ##close inner-loop
#end  ##close if-condition

#end ##close outer-loop
</table>

The Problem is, that Velocity breaks the outer-loop after representing the
inner loop. I can't understand why ?? In logical consequence it must be
continue ... The other Problem is, that after the inner loop, the array of the
project-data have the same datas like the array for the inner-loop  why in hell?

Could it be possible, that i can't use the concept of inner-loops in
Velocity? Thanks for any tip. It's realy urgent for me to know it is possible or
not, either i must implement the hole thing in JAVA with ECS, but this is not
fine, it breaks the MVC-Koncept ....

Thx in advance,
Christian


      


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>