<%@ taglib uri="webwork" prefix="ww" %> WebWork's HowTo's - Wizards

A wizard is a set of user interface pages that work together to achieve a specific purpose. For instance, a wizard might be defined to setup a database, configure a logger, or deploy an application. The wizard will present information to the user that will guide them through a process that will achieve the desired purpose. Each page should be simple, offering enough information so the user knows how to select/enter appropriate information to move to the next page. After each page is submitted, the page should be analyzed to see if the user should move to next page or go back to previous page and fix any errors. This step-by-step process is what makes wizards so popular. With WW's view mapping, validating, and error handling capabilities, wizards are easy to build.

For example, you may setup a wizard with view mapping shown below. Lets assume a user just clicked on a link to begin a wizard, the post would be to page1.action which would be mapped to action Page1. Page1 would perform any appropriate validation and execution. If there was an error, the user would be sent back to page1.jsp and the errors would be displayed for them to fix. If the action returned SUCCESS, then the user would be forwarded to page2.jsp. On this page, the user fills out appropriate information and selects next which would post to page2.action. And, the cycle continues until the wizard is finished.

Example view mapping:

page1.action=Page1
page1.error=page1.jsp
page1.success=page2.jsp

page2.action=Page2
page2.error=page2.jsp
page2.success=page3.jsp
...

Example page post:

<form action="<webwork:url page="page1.action"/>" method="POST">
...
</form>