Hello,
I have a problem when using a list data model with Mojarra 1.2_12 and
mapping the contents of h:inputText fields to a map in this model. My
stripped down JSP looks like this:
<h:dataTable var="rowData" value="#{testBean.model}">
<h:column>
<h:inputText id="Input" value="#{rowData.contentMap.input}" />
</h:column>
</h:dataTable>
<h:commandButton id="Submit" value="Submit" immediate="true" />
The row data:
public class RowData
{
private Map<String, String> contentMap = new HashMap<String, String>();
public Map<String, String> getContentMap() {
return contentMap;
}
public void setContentMap(Map<String, String> contentMap) {
this.contentMap = contentMap;
}
}
And the backing bean:
public class TestBean
{
private DataModel model;
public DataModel getModel() {
if (model == null) {
final List<RowData> list = new ArrayList<RowData>();
list.add(new RowData());
model = new ListDataModel(list);
}
return model;
}
}
When submitting a form with the immediate attribute of the command button
set to "false" everything works as expected: The response page is rendered
and the h:inputText field still contains the same text that was present
before submitting the form.
But when the immediate attribute is set to "true" for the command button
the content of h:inputText is lost when the response is displayed.
I do not understand why setting immediate to "true" results in the input data
getting lost. My understanding is that all input values should have been
preserved.
If h:inputText is not contained in a h:dataTable, the data in the input field
are still present when the response is rendered. This is just like I expect
it. The input only gets lost for any h:inputField in the data table. Why?
Thank you for your help.
Best regards Uwe
--
-----------------------------------------------------------------------
Dr. Uwe Seimet http://www.seimet.de/