Nested logic:iterate tags

2004-10-12 Thread Claus M. Christiansen
Hi ML...
I have kind of a problem which I just can't get solved!
I have an iterate tag inside an iterate tag, but in the nested iterate 
tag I need the indexed value from the outer iterate tag!!

I have:
html:form action=/storeCombiQuestion.do
   logic:present name=subQuestions scope=session
   logic:iterate name=subQuestions id=question 
indexId=subQuestion
  bean:write name=question property=text /
  logic:match name=question value=SingleChoice 
logic:iterate name=question property=possibleChoices 
id=option type=dk.procore.model.Option
html:radio property=answer 
value=%=option.getOption()% indexed=true
bean:write name=option property=option /
/html:radio
 /logic:iterate
 br /
   /logic:match
   /logic:iterate
   /logic:present
   html:submit /
/html:form

Now.. The problem lies in the nested iterate tag. The indexed=true 
takes the value from the iterate tag in which it is nested, but what I 
really need is the one from the outer tag, which is called subQuestion. 
The reason I need the 'outer' is because the html:radio is dependant on it.
I'm not even sure it can be done this way, but if it can't then I would 
like a suggestion of what to do then...

Thanks in advance...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Nested logic:iterate tags

2004-10-12 Thread Claus M. Christiansen

just use whatever id you are using for the indexId of the outer nested 
iterate.

nested:iterate property=outer indexId=fooIndex
nested:iterate property=inner indexId=barIndex
if you are using the nested EL tags or JSP2.0 you then have easy 
access to display the value of any indexId ... use either c:out 
value='${fooIndex}'/ if JSTL or if JSP2.0 just ${fooIndex}


The problem is not so much that I want to display it, cause that can 
also be done with bean:write tag, but I would like to use the outer 
index value for the html:radio ... indexed=true /. The generated 
HTML page looks like this

input type=radio name=org.apache.struts.taglib.html.BEAN[1].answer value=
input type=radio name=org.apache.struts.taglib.html.BEAN[2].answer value=0303
input type=radio name=org.apache.struts.taglib.html.BEAN[1].answer value=
input type=radio name=org.apache.struts.taglib.html.BEAN[2].answer value=0303
and so on. The number in BEAN[n] is the wrong one. It should be the same one in the 
first two and in the second two like this:
input type=radio name=org.apache.struts.taglib.html.BEAN[1].answer value=
input type=radio name=org.apache.struts.taglib.html.BEAN[1].answer value=
input type=radio name=org.apache.struts.taglib.html.BEAN[2].answer value=0303
input type=radio name=org.apache.struts.taglib.html.BEAN[2].answer value=0303
So the outer indexId, fooIndex, should be the one replacing 'n' in BEAN[n] instead of 
barIndex.
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]