要素のグリッドまたはマトリックスをダイナミックに構築するアプリケーションを作成しました。別のページに移動しようとすると、次のエラーが表示されます。
これはコードです:
private HtmlInputText createCelda(String vValue, String vStyle,
String vTitle, String vId, boolean vscript, boolean isreadonly) {
// private Application application;
// FacesContext fc = FacesContext.getCurrentInstance();
// application = fc.getApplication();
// private HtmlInputText ccelda;
ccelda = new HtmlInputText();
ccelda = (HtmlInputText) application
.createComponent(HtmlInputText.COMPONENT_TYPE);
ValueExpression ve = application.getExpressionFactory()
.createValueExpression(fc.getELContext(), vValue, String.class);
// ValueExpression ve = application.getExpressionFactory()
// .createValueExpression(fc.getELContext(), vValue, Integer.class);
ccelda.setValueExpression("value", ve);
ccelda.setStyleClass(vStyle);
ccelda.setTitle(vTitle);
ccelda.setId(vId);
ccelda.setReadonly(isreadonly);
if (vscript != false) {
ccelda.setOnkeydown(";return checkGrid(event, this.id);");
ccelda.setOnchange(";return changeValue(this.id);");
ccelda.setOnclick("this.select()");
}
return ccelda;
}
Bean からのデータでセルの行を作成する CODE
public UIComponent createPanelPrincipal(int nx, int ny, UIComponent panel) {
panelCeldas = createPanel(nx, "nacionI");
for (int i = 1; i < nx + 1; i++) {
String snx = i > 9 ? String.valueOf(i) : "0" + String.valueOf(i);
ncelda = createCelda("#{myBean.totalI[" + (i - 1) + "]}",
celdaNacionIStyle, "I" + snx, "I" + snx, true, false);
panelCeldas.getChildren().add(ncelda);
}
panel.getChildren().add(panelCeldas);
return panel;
}
このコードはTomcat 6.0.18で完璧に機能します
しかし、Tomcat 5.0 では次のエラーが発生します。
10-nov-2010 14:56:24 com.sun.faces.lifecycle.RenderResponsePhase execute
INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=form_composition:I15[severity=(ERROR 2), summary=(form_composition:I15: An error occurred when processing your submitted information.), detail=(form_composition:I15: An error occurred when processing your submitted information.)]
エラーを生成する行は次のとおりです。
ValueExpression ve = application.getExpressionFactory()
.createValueExpression(fc.getELContext(), vValue, String.class);
ccelda.setValue(myValue) だけを配置するとうまく機能しますが、Bean から値を取得する必要があるため、ValueExpression を使用します。
これをデバッグする方法がわかりません。誰かが興味を持っている場合は、それがどのように機能するかを確認するためのスタンドアロン プロジェクトがあります。