RE: logic:iterate inside a logic:iterate ??

2003-12-18 Thread Robert Taylor
logic:iterate id=document name=formName property=documents
logic:iterate id=lv name=document property=labelValueBeans
bean:write name=lv property=label/
bean:write name=lv property=value/
/logic:iterate
/logic:iterate

You should probably use JSTL for this.

c:forEach var=document items=${formName.documents}
c:forEach var=lv items=${document.lableValueBeans}
c:out value=${lv.label}/
c:out value=${lv.value}/
/c:forEach
/c:forEach


 -Original Message-
 From: gentyjp [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 18, 2003 12:16 PM
 To: [EMAIL PROTECTED]
 Subject: logic:iterate inside a logic:iterate ??
 
 
   
Hi
 
   I'am a Struts newbie, sorry if it is a classic question.
 
   My question is about logic:iterate
 
   I have a vector of documents.
   In my application a document is a vector of LabelValueBean. I wish to 
 write both the label and the value.
 
   I wish to write all my documents so I iterate through my vector 
 of documents.
 But after that how can I iterate through my vector of LabelValueBean ???
 
 Basically here's what I want to do :
 
 for_each_document
 {
  for_each_LabelValueBean_in_the_current_document
  {
   write LabelValueBean.Label;
   write LabelValueBean.Value;
  }
 }
 
 thanks for you help
 
 
Genty Jean-Paul
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:iterate inside a logic:iterate ??

2003-12-18 Thread Jan Vervecken
try something similar to this

(of course all the Java code to construct the lists should be in (or called by) a 
Struts Action class, so focus on the use of the logic:iterate tag)

--8loop.jsp--
%@ page import=java.util.* %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%!
public class Person
{
String fName = null;
LinkedList fEmailList = new LinkedList();
public String getName() { return fName; }
public LinkedList getEmailList() { return fEmailList; }
}
%
%
LinkedList vPersonList = new LinkedList();
Person vPerson = new Person();
vPerson.fName = Jan Vervecken;
vPerson.fEmailList.add([EMAIL PROTECTED]);
vPerson.fEmailList.add([EMAIL PROTECTED]);
vPersonList.add(vPerson);
vPerson = new Person();
vPerson.fName = Genty Jean-Paul;
vPerson.fEmailList.add([EMAIL PROTECTED]);
vPerson.fEmailList.add([EMAIL PROTECTED]);
vPerson.fEmailList.add([EMAIL PROTECTED]);
vPersonList.add(vPerson);
request.setAttribute(personList, vPersonList);
%

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html:html locale=true
HEAD
TITLEloop/TITLE
/HEAD
BODY
H3loop/H3

UL
logic:iterate id=person name=personList
LI
bean:write name=person property=name/
UL
logic:iterate id=email name=person property=emailList
LI
bean:write name=email/
/LI
/logic:iterate
/UL
/LI
/logic:iterate
/UL

/BODY
/html:html
--8--

success
-Jan

*** REPLY SEPARATOR  ***

On 12/18/2003 at 6:16 PM gentyjp wrote:

Hi

  I'am a Struts newbie, sorry if it is a classic question.

  My question is about logic:iterate

  I have a vector of documents.
  In my application a document is a vector of LabelValueBean. I wish to
write both the label and the value.

  I wish to write all my documents so I iterate through my vector of
documents.
But after that how can I iterate through my vector of LabelValueBean ???

Basically here's what I want to do :

for_each_document
{
 for_each_LabelValueBean_in_the_current_document
 {
  write LabelValueBean.Label;
  write LabelValueBean.Value;
 }
}

thanks for you help


   Genty Jean-Paul


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]