struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <jbarr...@sssc.com>
Subject RE: struts automation
Date Thu, 08 Jul 2004 23:22:25 GMT


> -----Original Message-----
> From: Michael McGrath [mailto:mike@michaelmcgrady.com]
> Sent: Thursday, July 08, 2004 4:10 PM
> To: Struts Users Mailing List
> Subject: RE: struts automation
> 
> 
> Okay, you meant source code.  I thought you meant class.  
> What are you 
> talking about?  Compiling?  Loading?  Admiring?  I could 
> learn from you, 
> Barrows.  You are a real tool expert, as opposed to a real expert 
> tool.  LOL  Thanks for the help.

Basically what Ted and I said earlier.  In WSAD, the struts-config editor has an edit button
next to where the class name is displayed.  Click it, and WSAD brings up an editor with that
class
in it.  If there is no class for the name you've provided ( i.e., you've typed the name in
by hand, or just
filled in the mapping part and hit edit.) 
then it will bring up the class creation wizard, with the defaults already set to create a

standard Action class all stubbed out with everything you need except the logic to do the
action.
Looks something like:
public class FooAction extends Action {

    public ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws Exception {

        ActionErrors errors = new ActionErrors();
        ActionForward forward = new ActionForward();
        // return value

        try {

            // do something here

        } catch (Exception e) {

            // Report the error using the appropriate name and ID.
            errors.add("name", new ActionError("id"));

        }

        // If a message is required, save the specified key(s)
        // into the request for use by the <struts:errors> tag.

        if (!errors.isEmpty()) {
            saveErrors(request, errors);

            // Forward control to the appropriate 'failure' URI (change name as desired)
            //	forward = mapping.findForward("failure");

        } else {

            // Forward control to the appropriate 'success' URI (change name as desired)
            // forward = mapping.findForward("success");

        }

        // Finish with
        return (forward);

    }
}

and you're off coding logic.
MyEclipse, IDEA and others will do something similar.
Like Ted said, really really cuts down on the nickel and dime BS quite a bit.
Any more and I think we're off topic.

> 
> Michael
> 
> At 02:45 PM 7/8/2004, you wrote:
> 
> 
> > > -----Original Message-----
> > > From: Michael McGrady [mailto:mike@michaelmcgrady.com]
> > > Sent: Thursday, July 08, 2004 2:42 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: struts automation
> > >
> > >
> > > My question is how can an editor of any kind create a class
> > > when it has no
> > > idea what the internals of the class are?  I clearly do not
> > > see what you
> > > guys are talking about because this clearly cannot be done
> > > and you seem to
> > > be saying that this is just a piece of cake.
> >
> >Because the editor takes the context from the struts-config file.
> >If you're looking at an action mapping, the class is there, 
> so it just 
> >pops up the class....
> >unless you're thinking .class as opposed to .java... when I 
> say class I'm 
> >talking about the source code...
> >
> >Can't be impossible since I do it every day, usually several 
> times a day 
> >in WSAD.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message