struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject AW: Dynamic dropDown List
Date Tue, 18 Jan 2011 08:37:19 GMT
Hi Chris,

Thank you for your reply, I had already try with the iterator but I had two problem:
	- I would like to put the <:property value="name"> in a dropdown List (<s:select>)
	- the answerList from the second iterator, depends from the current item from the first list

Something like:

<s:iterator value="questionList" status="qStatus">
     	<s:select label="<s:property value='description' />"
                <s:iterator value="answerList(<s:property value=questionId/>)" status="aStatus">
                	<option value="<s:property value='AnswerDescription'/>" name="<s:property
value='answerId'/>" />

Thank you for your help,

-----Urspr√ľngliche Nachricht-----
Von: Chris Pratt [] 
Gesendet: Montag, 17. Januar 2011 19:22
An: Struts Users Mailing List
Betreff: Re: Dynamic dropDown List

The Struts documentation can be pretty helpful here.  Here's an excerpt from
(I changed the variable names to match yours):

 <s:iterator value="questionList" status="qStatus">
     <tr class="<s:if test="#qStatus.odd == true ">odd</s:if><s:else>even</s:else>">
         <td><s:property value="name"/></td>
         <td><s:property value="description"/></td>
             <s:iterator value="answerList" status="aStatus">
                 <s:property value="description"/><s:if test="!#aStatus.last">,</s:if>

If you need to access the current question while inside the answer loop, look at the var attribute.

On Mon, Jan 17, 2011 at 2:59 AM, <> wrote:

> Hello,
> This is my first request in this mailing list, I hope I am doing it right !
> I am currently developing a Portlet for Liferay using Struts 2, it is 
> working good and I am often surprised with all the possibilities from 
> Struts2.
> Unfortunately I have a blocker !
> I would like to design a form with a survey thanks to dropDown List 
> and would like to get all the content from a database.
> In the database, there are a table question (questionId, questionName) 
> and a table answer (answerId, answerName, questionId) and I would like 
> to generate all the dropdown from these table...
> While (question)
> {
>        While {answer from this question)
>        {
> }
> I tried many solutions, but I didn't achieved it!
> Thank you for your help,
> Mat
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message