You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Balahura <rj...@sciborg.uwaterloo.ca> on 2000/06/26 06:20:08 UTC

STRUTS DEBUG

Are there built in debugging mechanisms to debug classes in struts?  For
example, to check what values are being retrieved from my FormClass by my
ActionClass?


Re: STRUTS DEBUG

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Robert Balahura wrote:

> Are there built in debugging mechanisms to debug classes in struts?  For
> example, to check what values are being retrieved from my FormClass by my
> ActionClass?

There is nothing built in to Struts at the moment to assist in this.

One relatively easy approach might be to subclass ActionServlet with a
special version that overrides the processActionInstance() method.  The
overridden class might look like this:

    protected void processActionInstance(...) throws ... {

        ... log the details of the passed formInstance ...
        super.processActionInstance(...);

    }

One trick I use in my programs (to make this sort of thing easier) is to
implement a toString() method on my ActionForm beans, that dumps out the
interesting contents into the result string.  That way, in my override method
above, I can say something like this:

    getServletContext().log(formInstance.toString());

and the String version of the form bean will get logged to the servlet log,
without the servlet having to know anything about the insides.

Craig McClanahan