Hi!
I have the following class:
public class Question implements Serializable {
private Integer id;
private String content;
private String type;
private List<Answer> answers = new ArrayList<Answer>();
.....
}
And class answer:
public class Answer implements Serializable{
private Integer id;
private String content;
....
}
I would like to iterate over the questions, and for each one display the
option to choose the answer in a radio button.
In the action class I have the followings:
List<Question> videoQuestion = ... (I get it from the database).
List answers;
I wrote the following code:
<s:iterate value="questions" status="pos" var="question">
<s:property value="#question.content" />
<s:radio name="answer[#pos.index]" list="#question.answers" listKey="id"
listValue="content" />
</s:iterate>
But I get an error message:
Error on line 25, column 9 in template/simple/radiomap.ftl
stack.findValue(parameters.listKey) is undefined.
It cannot be assigned to itemKey
The problematic instruction:
----------
==> assignment: itemKey=stack.findValue(parameters.listKey) [on line 25,
column 9 in template/simple/radiomap.ftl]
in user-directive s.iterator [on line 23, column 1 in
template/simple/radiomap.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Error on line 25, column 9 in
template/simple/radiomap.ftl
stack.findValue(parameters.listKey) is undefined.
It cannot be assigned to itemKey
at freemarker.core.Assignment.accept(Assignment.java:111)
at freemarker.core.Environment.visit(Environment.java:209)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
why is it? I have getter and setter for id and content parameters of class
Answer.
As well, how can I retrieve the answers in the best way?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]