...
Looking over the markup, it's easy to see why Java web development without the aid from a modern framework is hard! So far, we've only coded two controls, and there are six more to go! Let's rewrite and finish the form using Struts Tags.
|
|
...
Here's a typical configuration (struts.xml
) for a login workflow:
Code Block | ||||
---|---|---|---|---|
| ||||
<struts> <package name="default" extends="struts-default"> <action name="Logon" class="mailreader2.Logon"> <result name="input">/pages/Logon.jsp</result> <result name="cancel" type="redirect-actionredirectAction">Welcome</result> <result type="redirect-actionredirectAction">MainMenu</result> <result name="expired" type="chain">ChangePassword</result> </action> <action name="Logoff" class="mailreader2.Logoff"> <result type="redirect-actionredirectAction">Welcome</result> </action> </package> </struts> |
The framework provides general-purpose defaults, so we can start using Struts right away, "out of the box". Any factory defaults can be overridden in an application's configuration, as needed.
...