struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Struts--question about bean/form name.
Date Wed, 21 Jun 2000 18:17:31 GMT
Kevin Duffey wrote:

> Hi,
>
> I would say..use the source, and modify the actual source in some way for
> your needs. The downside is..as Craig updates the builds..you'll have to
> keep modifying the code again and again. Unless..you just make a hook call
> from inside the Struts source. Then you simply add that call to each new
> build, and paste in your method that handles whatever it is you need. I
> built the source and added a bunch of out.printlns because I was having
> problems with JDK1.3 and Orion..thus how I learned about the JDK 1.3 bug
> with resource bundles.

For customizations that are less fragile, you can also subclass ActionServlet
and override the methods that do the specific functionality you want to
change.  For example, if you wanted to do something special before and after
the usual call to the action class, you could do this:

    public class MyActionServlet extends ActionServlet {

        protected void processActionInstance(ActionMapping mapping,
            ActionForm formInstance, HttpServletRequest request,
            HttpServletResponse response)
                throws IOException, ServletException {

            doMyPreprocessing();
            super.processActionInstance(mapping, formInstance,
              request, response);
            doMyPostprocessing();

        }

    }

which will survive changes in the underlying code as long as the method
signatures are not changed.

At the moment, we're still in a little bit of flux as we accumulate and
implement all the good ideas that have been suggested.  Once a 1.0 release
occurs, incompatible changes to the method signatures will be avoided if at
all possible, to maintain backwards compatibility of customizations like the
one above.

Craig McClanahan





Mime
View raw message