restoring values from managed bean
i have a page with the list of all rows that i want to display as a dataTable.
After the user clicks on the commandlink in the specified row, he gets redirected to a new page with detail information. On this second page there are two selectOneMenu components. The first one changes the values for the second one. When I click on the detail link i get a new page(with details) with the right values. But whenever i change the value in my first selectOneMenu and the form is submitted i get exception saying that the values for selectOneMenu are null. Could you please explain to me how to get this values set?
On my first jsp page i hava a datatable:
<h:dataTable id="travelTable"
value="#{travelDetailsView.travels}"
binding="#{travelDetailsView.travelDataTable}"
var="vartravelRow" >
....columns
<h:commandLink id="details" action="showTravel" actionListener="#{travelDetailsView.showTravel}" value="details" onmousedown="doSubmit()">
detail page:
<h:selectOneMenu id="hotelMenu" value="#{travelDetailsView.travelRow.hotelId}"
onchange="submit();" valueChangeListener="#{travelDetailsView.hotelValueChange}"><f:selectItem itemLabel="choose hotel" itemValue="0"/>
<f:selectItems value="#{travelDetailsView.travelRow.hotels}"/>
</h:selectOneMenu>
<h:selectOneMenu id="apartmentMenu" onchange="submit();" >
<f:selectItem itemLabel="choose apartment" itemValue="0"/>
<f:selectItems value="#{travelDetailsView.travelRow.selectedHotelRow.apartments}"/>
</h:selectOneMenu>
and coresponding managed-bean:
private TravelRow travelRow;
private DataModel travelModel =new ListDataModel();
private TravelDataJBean travelJBean=new TravelDataJBean();
private HtmlDataTable travelDataTable;
publicvoid showTravel(ActionEvent event)throws Exception{
travelRow=(TravelRow)travelModel.getRowData();
}
publicvoid hotelValueChange(ValueChangeEvent event){
Integer oldValue = (Integer) event.getOldValue();
Integer newValue = (Integer) event.getNewValue();
travelRow.setHotelId(newValue);
FacesContext context = FacesContext.getCurrentInstance();
context.renderResponse();
}
the problem is gone when the managed bean is session scoped but i want it to be request. I know that after changing the value in the hotelMenu the travelRow is somehow lost. So is there a solution to have it restored somehow?

