I am currently getting deeper into JSF 2.0 and not sufficiently versed in the "transport" of managed bean properties from one view to another. I searched a little, but did not find a really good example, so if someone could point me to a textbook or explain it a bit, I would be very grateful.
So here is my scenario:
I am developing a small calendar application for playgrounds. The first view select.xhtmlcontains a calendar selector where the user can select a specific date:
<html>
...
<h:form>
<p:calendar value="#{calendarSelect.date}" mode="inline" navigator="true" />
<p:commandButton value="Show entries for date" action="day" />
...
My relevant bean support looks like this:
@ManagedBean(name="calendarSelect")
@RequestScoped
public class CalendarSelectComponent {
private Date date = null;
...
Now when I submit the form from select.xhtml, I am redirected today.xhtml
<html>
...
<h:form>
The current day ist:
<h:outputText value="#{calendarEdit.date}">
<f:convertDateTime pattern="dd.MM.yyyy" />
</h:outputText>
Bean support now looks like this:
@ManagedBean(name="calendarEdit")
@ViewScoped
public class CalendarEditComponent implements Serializable {
private Date date = null;
private CalendarEntryBean currentEntry = null;
private List<CalendarEntryBean> allEntries = null;
....
: date ?
, :
<p:commandButton value="Show entries for date" action="day" />
<f:setPropertyActionListener target="#{calendarEdit.date}" value="#{calendarSelect.date}" />
</p:commandButton>
, , date calendarEdit calendarSelect, day.xhtml - , CalendarEditComponent bean , select.
, SessionScoped bean, . , , , , , "" . , , - , , , , , ..
, , , , JSF , .
, , - , - !; -)