struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Dynamic dropDown List
Date Mon, 17 Jan 2011 18:22:19 GMT
The Struts documentation can be pretty helpful here.  Here's an excerpt from
http://struts.apache.org/2.1.8.1/docs/iterator.html (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>
         <td>
             <s:iterator value="answerList" status="aStatus">
                 <s:property value="description"/><s:if
test="!#aStatus.last">,</s:if>
             </s:iterator>
         </td>
     </tr>
 </s:iterator>

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

On Mon, Jan 17, 2011 at 2:59 AM, mreisz@4sxs.de <mreisz@4sxs.de> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message