First, I think you should add volatile=true to your For components.
Second, you have to add the text itselt, using InsertText or Insert.
Note that the answer's value will be set to the java property, so you
can use arbitrary objects. Its a text-value pair. Tapestry is taking
care of the value, you of the text...
Cheers,
Ron
ציטוט Borut Bolčina:
Hello,
I want to design a page that can display an arbitrary number ob radio
groups, each one having arbitrary number of radio buttons. This is
controlled with xml configuration file. I can make Collection objects as
a result of parsing this xml conf file to feed the For component.
Where am I failing? Answers beside radio buttons aren't displaying. Here
is what I get http://borut.aza-ms.si/app.htm (in my language).
I imagine I must use two For components:
html:
<span jwcid="questions">
<dt><span jwcid="question">Question</span></dt>
<span jwcid="radioGroupForAnswers">
<span jwcdid="answers">
<dd><input type="radio" jwcid="answer" />answer</dd>
</span>
</span>
</span>
page:
<component id="questions" type="For">
<binding name="source" value="ognl:questions"/>
<binding name="value" value="ognl:question"/>
</component>
<component id="question" type="Insert">
<binding name="value" value="question"/>
</component>
<component id="radioGroupForAnswers" type="RadioGroup">
<binding name="selected" value="ognl:answer"/>
<binding name="validators" value="validators:required"/>
</component>
<component id="answers" type="For">
<binding name="source" value="ognl:answers"/>
<binding name="value" value="ognl:answer"/>
</component>
<component id="answer" type="Insert">
<binding name="value" value="answer"/>
</component>
java:
abstract public String getAnswer();
abstract public String getQuestion();
public Collection getQuestions() { return
getMyApp().getQuestions(); // returns a Collection<String> by parsing
xml } public Collection getAnswers() {
Collection<String> answers = new ArrayList<String>();
answers.add("answer 1"); // should be parsed from xml (1.a)
answers.add("answer 2");
answers.add("answer 3");
return answers; // dummy test
}
configuration file:
<questionnaire>
<set week="45">
<question text="First question for first week">
<answers>
<answer>1.a</answer>
<answer correct="true">1.b</answer>
<answer>1.c</answer>
</answers>
</question>
<question text="Second question for first week">
<answers>
<answer correct="true">2.a</answer>
<answer>2.b</answer>
<answer>2.c</answer>
</answers>
</question>
<question text="Third question for first week">
<answers>
<answer>3.a</answer>
<answer correct="true">3.b</answer>
<answer>3.c</answer>
</answers>
</question>
</set>
<set week="46">
<question text="First question for second week">
<answers>
<answer>1.a</answer>
<answer correct="true">1.b</answer>
<answer>1.c</answer>
</answers>
</question>
<question text="Second question for second week">
<answers>
<answer correct="true">2.a</answer>
<answer>2.b</answer>
<answer>2.c</answer>
</answers>
</question>
</set>
</questionnaire>
Regards,
Borut
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]