In an earlier post, I described a class to handle redirects in Struts and passing parameters along. That technique is not necessary; as of Struts 1.2.7, you can use the ActionRedirect class instead.

Read the rest of this entry »

OnJava has an interesting article on generic approach to handling exceptions within a J2EE framework. The basic idea involves creating a generic base class for exceptions and a basic handler for all requests that includes dispatcher to pass the request along to the appropriate method.
The fundamental idea is fairly sound and the idea of including a context to allow reuse of generic exceptions seems like a strong idea. My concern is that in a large project, the use of a "context" may make it difficult to figure out which specific message code is used in a given place. The generic exception handling is especially beneficial for the "this should never happen" cases where there isn't much the app can do about the exception, but should still handle it in a robust manner.

Struts Redirect w/Parameters

January 24, 2006

If you have a Struts Action servlet and you want to redirect to another page, the standard Struts technique is to return an ActionForward and setup an appropriate forward entry in struts-config.xml:

return mapping.findForward("success");

Unfortunately, this doesn’t provide a mechanism for passing request parameters to the target. So what can you do if you want to redirect to another page and pass some parameters along? You use an additional class:

Read the rest of this entry »

Prefactoring

December 28, 2005

Prefactoring is the process of using your experience to write better code.  Specifically, writing code that can be refactored more easily, that is easier to read and easier to maintain.

The article is available on oreillynet.com:
What Is Prefactoring?
by Ken Pugh, author of Prefactoring