[Logo] Mentawai Forum - Mentawai Web Framework
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 

Forum Read-Only! Check the new site and forum here!

RESOLVED - Nested mtw:loops; accessing variables from the parent loop  XML
Forum Index -> General Comments
Author Message
navigo



Joined: 17/06/2008 11:27:55
Messages: 7
Offline

Hello:

Probably a very basic question, but being a newb, must ask it. I have an <mtw:loop> inside of an <mtw:loop>, and would like to access a value that was available in the parent loop. Is there a way to do that?

Code:
 		<mtw:list value="user.customer.services">
 		    <mtw:loop>
 			<tr>
 			    <th colspan="4"><mtw:out value="name"/></th>
 			</tr>
 			<tr>
 			    <th>Source Number</th>
 			    <th>Dialed Number</th>
 			    <th>Enabled ?</th>
 			    <th>Actions</th>
 			</tr>
 			<tr>
 			    <td> - </td>
 			    <td> - </td>
 			    <td> - </td>
 			    <td><a href="<mtw:contextPath />/CallBlockAction.add.mtw?id=<mtw:out value="id" />">Add</a></td>
 			</tr>
 			<mtw:list value="callBlocks">
 			    <mtw:loop>
 				<tr>
 				    <td><mtw:out value="sourceNumber" /></td>
 				    <td><mtw:out value="dialedNumber" /></td>
 				    <td><mtw:out value="enabled" /></td>
 				    <td>
 		*******               <a href="<mtw:contextPath />/CallBlockAction.edit.mtw?id=<mtw:out value="id" />&serviceId=<mtw:out value=".id" />">Edit</a>
 					<a href="<mtw:contextPath />/CallBlockAction.delete.mtw?id=<mtw:out value="id" />">Delete</a>
 				    </td>
 				</tr>
 			    </mtw:loop>
 			</mtw:list>
 		    </mtw:loop>
 		</mtw:list>
 


In the <a href> above (that is marked with *******), I would like to include the id of the service from the parent loop. Can anyone enlighten me?

I know that I could include the id of the service in the callBlock object, but that seems to be redundant.... Is that my option?

Thanks in advance.
navigo



Joined: 17/06/2008 11:27:55
Messages: 7
Offline

Awesome,

All I had to do was post, then I found the answer.....

Code:
 
 <mtw:loop var="service">
 ....
 <mtw:loop>
 //here I can access the var from the service loop as service.id
 </mtw:loop>
 </mtw:loop>
 


Many thanks.

PS Also, mentaframework rocks. I spent alot of time looking at tapestry and this one won out because of the design philosophy, up to date documentation, and the seemingly "common sense" approach to getting things done. For the first time ever in java web development, I have been able to apply the "it seems like it ought to work this way" approach and have it work. Well done!
 
Forum Index -> General Comments
Go to:   
Powered by JForum 2.1.6 © JForum Team