|
The sequence number is implemented on the Struts platform,
with a known attribute of the form bean with name page. Custom
navigation rules could be implemented, like the case of Wizard, in which case this
variable would be used to decipher what the next page or previous page should
be.
To implement this, a hidden variable must be defined on the
page.
The page value could be static on the page.
<html:hidden property="page" value="2"/>
Or else, it could be set on the server side.
<html:hidden property="page"/>
Struts validations support this mode of usage, by allowing
the specification of for an element on a page, to indicate when its validation
becomes active. The validation for the elements on the page would be designated
with the page attribute of their validation specification. See the page
attribute in the code snippet below.
<form name="categoryForm">
<field property="categoryName" depends="required" page="1">
<arg0 key="categoryForm.categoryName.label"/>
</field>
</form>
To understand the essence of this, we should recall that the
same form bean could be associated with multiple pages. It is possible to
configure validation for the different instances by using the page number.
As an alternative, the page or sequence number could be set
on the server side. This allows creating logic whereas a page has a full set of
elements, but different sub-sets are made visible or enabled based on the page
number set on the server side. In other words, the same page could be presented
as a series of page, by changing the set of elements that are visible.
The subset could be delineated using the element attribute
group-id. For more discussion on this see the element descriptor attributes.
|