Use global result handlers for common results
Often, actions will share a number of common results. Rather than configure redundant result elements for each action, share common results through a global result handlers.
<struts> <global-results> <result name="error"> /common/Error.jsp </result> <result name="invalid.token"> /common/Error.jsp <result name="login" type="redirectAction"> Login_input </result> </global-results> <!-- ... --> </struts>Using global result handlers ensures that common results will be handled consistently, while reducing redundant code. Global results increase coupling, but any action that needs to handle a result differently can provide a local handler.
HTH, Ted.
Ted Husted is a software engineer and team mentor. His specialty is building agile web applications with open source products like Yahoo! User Interface Library, Struts, Spring, iBATIS, and MySQL, for either Java or Microsoft .NET, and helping others do the same.
Copyright Ted Husted 2007. All rights reserved.