Hi Andriaan,

can you please paste your entire template?

On 29 May 2006, at 14:15, apdewith wrote:

Hi Geert,

Thanks for the support but I am afraid I do not understand your last reply. I experimented with different code and template solutions but with no success. I want to share my last try because I fear that my understanding of the templating mechanism is not correct.

   public void doReservationList() {
              String action = getParameter( "Action" );
Reservation reservation = (Reservation)getSubmissionBean ( "reservationList", Reservation.class, "rl_" );
       mReservationId = reservation.getId();
       mTemplate = getHtmlTemplate( "tbs.browseReservations" );
LOG.debug( "doReservationList: " + action + " " + mReservationId );
                 if( "Details".equals( action ) ) {
           mMode = "display";
           mTab = "reservation";
           buildReservationList( mReservationId );
           showReservationSeatsCustomerPaymentsTab();
           setReservationTabCurrent();
processEmbeddedElement( mTemplate , ".ReservationDetails", String.valueOf( mReservationId ) ); mTemplate.setBlock( "reservationDetails", "reservationDetails" );
           mTemplate.setValue( "seatList", "" );
          print( mTemplate );
       }
       if( "Seats".equals( action ) ) {
           mMode = "display";
           mTab = "seatList";
           buildReservationList( mReservationId );
           showReservationSeatsCustomerPaymentsTab();
           setSeatsTabCurrent();
           reservation = Reservation.RetrieveById( mReservationId );
           Seat[] seats = reservation.seats();
           int nrofSeats = reservation.seats().length;
           for( int i = 0; i < nrofSeats; i++ ) {
               int seatId = seats[i].getId();
processEmbeddedElement( mTemplate, ".SeatEntry", String.valueOf( i ) + "_" + String.valueOf( seatId ) + "_" + String.valueOf( mReservationId ) ); mTemplate.appendBlock( "seatDetailsList", "seatEntry" );
               mTemplate.setValue( "reservationDetails", "" );
           }
           mTemplate.setBlock( "seatList", "seatList" );
           print( mTemplate );
       }
   }

For completeness the template snippet:

       <div>
           ${v reservationDetails}${/v}
           ${b reservationDetails}
               ${v ELEMENT:.ReservationDetails:/}
           ${/b}
       </div>
             <div>
           ${v seatList}${/v}
           ${b seatList}
               <div id="tabContent" class="tabContent">
                   <table id="row" class="displaytag">
                       <tr>
                           <th><em>id</em></th>
                           <th><em>seatId</em></th>
                           <th><em>reservationId</em></th>
                           <th><em>firstName</em></th>
                           <th><em>lastName</em></th>
                           <th><em>birthDate</em></th>
                           <th><em>street</em></th>
                           <th><em>zip</em></th>
                           <th><em>city</em></th>
                           <th><em>country</em></th>
                           <th>&nbsp;</th>
                       </tr>
                       ${v seatDetailsList/}
                       ${b seatEntry}
                           ${v ELEMENT:.SeatEntry:/}
                       ${/b}
                   </table>
               </div>
           ${/b}
       </div>

With this the "Details" action displays the reservationDetails and a totally empty seatList. But the "Seats" action displays both an empty reservationDetails (correct) and the fixed part of seatList but an empty seatDetailsList. If I remove the reservationDetails div from the template the "Seats" action display ok. So, the same code for the "Seats" action behaves differently in the two template variations and I do not see why.

If the template mechanism is not meant to be used like I try, I would like to know because I then have to rethink my approach.

Kind regards,
Adriaan de With


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to