In the "Coding Actions" lesson, we created a Logon class that tests for input. In the "Selecting Results" lesson, we act on the outcome of that test.
...
After the Action processes a request, a result is selected to provide the response. A result may simply forward to a an HTML page, or a JavaServer page, a FreeMaker or Velocity template, or the result might construct a PDF or some other complex report (like JasperReports). There may be multiple results available to an action mapping. To indicate which one to select, the Action class returns a name corresponding to the appropriate result.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<action name="Logon" class="tutorial.Logon"> <result type="redirect-actionredirectAction">Menu</result> <result name="input">/tutorial/Logon.jsp</result> </action> |
...
The Logon mapping uses a different return type for "success" (the default result code). The redirect-action
redirectAction
result type takes the name of an Action (as configured in the struts.xml
file) as a parameter, and then issues a client-side redirect to the new action. As a result, the URI on the browser's location bar will change.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<html> <head><title>Missing Feature</title></head> <body> <p> This feature is under construction. Please try again in the next interationiteration. </p> </body> </html> |
How the Code Works
...
- The framework will return the stub "Menu.jsp" for now.
Tip |
---|
...
If you are not using wildcards, another way to inject a "missing" page would be to specify a |
...
|
...
|
...
Including a Missing Page
If you are building an application page by page, it can be worthwhile to setup a standard "Missing" page, and then include it from your stubs.
...