concept user in category seam

appears as: user, users, The user, user, users
Seam in Action

This is an excerpt from Manning's book Seam in Action.

The second role of entity classes in a Seam application is to serve as form “backing” beans (akin to a Struts ActionForm) to capture input from the user, thus replacing the need for a shallow “backing” bean class. An entity class becomes a candidate for use in a JSF view if it has a @Name annotation on its class definition, a condition that is satisfied by the GolfTip class in listing 1.1. You then bind the form inputs directly to properties on the entity class and JSF handles the necessary conversions and validations.

To demonstrate the use of a long-running conversation, let’s work through an example of a multipage wizard that captures information about a golf course and adds it to the Open 18 directory. Entering data for a golf course can be quite intimidating, so a wizard is used to break up the form into short, logical steps, shown in figure 7.5. Each box in figure 7.5 represents a screen with a form to fill out. As the user moves from screen to screen, the information from previous screens must be accumulated and stored so that it’s available when the final screen is complete and the course is persisted to the database.

Figure 7.5. The wizard allows the user to enter a new golf course into the directory.

Let’s say that, at any point in the course wizard, you want to allow users to be able to view a summary in a preview window of what they’ve entered so far. The following link will open the preview window and give it access to the long-running conversation used by the course wizard:

Let’s say that, while working through the course wizard, the user realizes the information about the course’s facility is incorrect. While the error is fresh in the user’s mind, you want the user to be able to pause the course wizard and go update the facility. As it stands now, editing a facility joins the existing conversation. When the user saves the facility, the conversation ends. However, you don’t want the conversation for the course wizard to end too. Instead, you want to return users to the course wizard and let them continue as though they never left. Keeping the use cases isolated, yet linked, calls for a nested conversation.

If there’s no long-running conversation available at the time, the nested directive has the same effect as the begin directive. However, you can’t join and nest at the same time. If the current conversation is long-running, Seam begins a nested conversation, even if the current conversation is itself a nested conversation. That means each time the user performs a postback, it’s going to spawn yet another nested conversation. We prevent Seam from beginning a nested conversation if one already exists by using a conditional on the <begin-conversation> element in the FacilityEdit.page.xml descriptor:

  <begin-conversation nested="true" if="#{!conversation.nested}"/>

Now, when the user clicks Save on the facility editor screen, the nested conversation is ended and the long-running conversation that manages the course wizard is restored.