|
| Submiting dynamic textareas using <netui:Repeater> |
 |
Sun, 27 Apr 2008 01:40:30 -070 |
Hello Everybody,
I create textareas and radiobuttons dynamically (It's ok).
When I submit the form I get the next error message:
(and object array is null)
NetUI Warning: Unable to update expression
"{actionForm.answers[0].text}". The typical cause is that the object
represented by the expression is not available or is the wrong type for
updating. Cause: com.bea.wlw.netui.script.ExpressionUpdateException: Exception
when attempting to update the expression
"{actionForm.answers[0].text}" with available binding contexts
[actionForm, pageFlow, globalApp]. Root cause:
knex.scripting.javascript.EvaluatorException: The undefined value has no
properties.
Does anyone have any clue about this behaviour?
Here is my source:
//JPF:
public class Answers implements Serializable
{
private Integer answerID;
private String text;
private Boolean rightAnswer;
public Answers(Integer answID, String answ, Boolean ra) throws Exception
{
this.answerID = answID;
this.text = answ;
this.rightAnswer = ra;
}
public Integer getAnswerID() { return this.answerID; }
public String getText() { return this.text; }
public void setText(String t) { this.text = t; }
public Boolean isRightAnswer() { return this.rightAnswer; }
}
public static class ModifyForm extends FormData
{
private Integer rightAnswer;
private Answers[] answers;
public Answers[] getAnswers() { return this.answers; }
public void setAnswers(Answers[] ans) { this.answers = ans; }
public void setRightAnswer(Integer rightAnswer) { this.rightAnswer =
rightAnswer; }
public Integer getRightAnswer() { return this.rightAnswer; }
}
/**
* @jpf:action
* @jpf:forward name="success" path="index.jsp"
*/
protected Forward goModify()
{
modifyForm = new ModifyForm();
Answers[] answers = new Answers[rs.length]; //rs : result of query from
database
for (int i = 0; i < rs.length; i++)
{
answers[i] = new Answers(rs[i].getAnswerID(), rs[i].getText(),
rs[i].isRightAnswer());
}
modifyForm.setAnswers(answers);
modifyForm.setRightAnswer(new Integer(0));
return new Forward("success", modifyForm);
}
//JSP:
<netui:form action="modifyQuestion">
...
<netui-data:repeater dataSource="{actionForm.answers}">
<netui-data:repeaterHeader>
<table>
<tr>
<td align="center"
valign="middle"><i18n:getMessage
messageName="rightAnswer"/></td>
<td align="center"
valign="middle"><i18n:getMessage
messageName="text"/></td>
</tr>
</netui-data:repeaterHeader>
<netui-data:repeaterItem>
<tr>
<td width="5%" align="center"
valign="middle">
<netui:radioButtonGroup
dataSource="{actionForm.rightAnswer}">
<netui:radioButtonOption
value="{container.item.answerID}"> </netui:radioButtonO
ption>
</netui:radioButtonGroup>
</td>
<td width="100%" align="center">
<netui:textArea
dataSource="{container.item.text}"
defaultValue="{container.item.text}" cols="40"
rows="4"/>
</td>
</tr>
</netui-data:repeaterItem>
<netui-data:repeaterFooter>
</table>
</netui-data:repeaterFooter>
</netui-data:repeater>
...
<netui:button type="submit"><i18n:getMessage
messageName="save"/></netui:button>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|