I have created an application which build a grid or a matrix of elements dinamycally. When I try to navigate to another page I get an error:
This is the code:
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;
}
CODE to create a row of cells with the data from the bean
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;
}
This code WORKS PERFECT in tomcat 6.0.18
but in Tomcat 5.0 I get the next error:
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.)]
The line which produce the error is:
ValueExpression ve = application.getExpressionFactory()
.createValueExpression(fc.getELContext(), vValue, String.class);
If I put just ccelda.setValue(myValue), works great, but I need to get the value from the bean, that the reason I use the ValueExpression.
I can't see a way to debug this. If anyone is interested I have a stand-alone project to see how it works.