I have a JSP page (page1.jsp) showing a data table. There are also buttons in the table like this:
<h:column>
<f:facet name="header" >
<h:outputText value=""/>
</f:facet>
<h:commandButton value="Show items" action="#{firstBean.displayItems}" immediate="true" />
</h:column>
The bean:
public void displayItems() throws IOException {
MyClass theClass = (MyClass) dataTable.getRowData();
String theId = theClass.getIdentityNumber();
// ...
}
When we click on the button I want to move to another JSP page (page2.jsp). On page 2, there is also a data table. This table is created via a call to a bean called "facade" and a parameter (String - id). I.e when the button is pressed, I want to be moved to JSP page 2, and this page will display a datatable based on a call like this:
myList = facade.getDeliveriesById(theId);
So page 2 is dependent on stuff from page 1, either a string id, or if one can somehow set a list?
I guess the question is:
- Should I in "firstBean.displayItems" make a redirect to jsp page 2 with a "get" paramater, after extracting this id (see above) ?
- Is there a way of setting the list to be used on page 2 there in "firstBean.displayItems"?
What's the normal way of going from one page to another in JSF (with data)?