Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Spring Web Flow View Navigation

In Spring web flow, normal practice is to display a view when a state change occurs; this is exactly what happens in the first view-state tag encountered in Listing 3. The view displayed is the itemlist.jsp page. In itemlist.jsp, the important display code is the table definition shown in Listing 5.

Listing 5 The table definition.

<table border="1" width="300px">
   <c:forEach var="item" items="${list}">

The c:forEach loop in Listing 5 displays the current contents of the item list. Following the table definition in Listing 4 is the communication back to Spring web flow, which in this case occurs when you enter some text and click the Add New Item button (see Listing 6).

Listing 6 State transition driven by JSP.

   <td class="buttonBar">
   <!-- Tell webflow what event happened -->
   <input type="submit" name="_eventId_add" value="Add New Item">

Clearly, some mechanism is required to ensure that user actions made against JSP pages get reflected back to the flow definitions. In Listing 6, the JSP control returns "_eventId_add", which serves to effect the next state transition.

  • + Share This
  • 🔖 Save To Your Account