We use the global exception handler in Struts today for
PermissionException, LookupException, etc. This is a great way of
sending users to an error page and keep the struts-config a bit
cleaner. It also keeps your action cleaner.
For example, say you want to send a user to an error page (this
is different than an error message at the top of a page), instead
of doing this:
public class SomeAction {
...
try {
// do something
} catch (Exception e) {
log.error("message", e);
return mapping.findForward("error");
}
}
You can simply do this:
public class SomeAction {
...
try {
// do something
} catch (Exception e) {
throw new SomeMappedException();
}
}
You can reuse this SomeMappedException in other actions like
we do with the PermissionException today.
--
jesus m. rodriguez | [email protected]
sr. software engineer | irc: zeus
rhn satellite & spacewalk | 919.754.4413 (w)
rhce # 805008586930012 | 919.623.0080 (c)
+-------------------------------------------+
| "Those who cannot learn from history |
| are doomed to repeat it." |
| -- George Santayana |
+-------------------------------------------+
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel