A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
iterator and <s:radio /> question
Jordan Smith
Ranch Hand
Joined: Apr 06, 2008
Posts: 89
posted
Oct 14, 2009 07:33:29
0
hi!
I was half answered in the past and am still stuck.
i have list of qustions, and have to iterate over them. for each one to display the possible answers, and to save what the user have chose.
so i wrote:
<s:iterator value="videoQuestion" status="pos"> <s:property value="%{pos.count}" />. <s:property value="content" /> <s:radio name="answer%{id}" list="answers" listKey="id" listValue="content" /> </s:iterator>
1. how can i save what the user chose?
i tried to declare in my action class:
List<
String
> answer;
but it's null.
I have to know which answers where chosen.
2. <s:property value="%{pos.count}" />. is empty. i would like to display the iterator value like 1,2,3 etc.
How can i do it?
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Oct 14, 2009 08:30:41
0
The name should use array notation; put the index inside square brackets ([]).
Try
%{#pos.count}
.
Jordan Smith
Ranch Hand
Joined: Apr 06, 2008
Posts: 89
posted
Oct 14, 2009 08:42:37
0
thanks!!
you are a master, David!
I agree. Here's the link:
http://aspose.com/file-tools
subject: iterator and <s:radio /> question
Similar Threads
s:iterator problem...
validate that a radio button was chosen struts2
Displaying the fields in an order
struts-2 iterator issue...
RadioButton with List Struts 2
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter