Hmmmm.... this is a good point.

In the past I have created a map wrapper that wraps the request object and
session object and passed those as well.
the advantage is that the execute method is a little easier to test since it
does not rely on the servlet API.

The execute method would look something like this:


protected abstract String execute(ActionForm form, Map request, Map
session);

The string is the name of the forward. Again, the advantage from a TDD
perspective is I can easily write tests for the above.

I think I have an example of this approach in the Mastering Tomcat book (I
wrote about 1/5 of that). I do not have an example of this in the
Professional Struts book, but there would be if I had the often elusive more
time.

I was thinking of taking the approach in the ProcessAction from scaffold and
the PicoContainer (or something of that ilk), and doing something similar
with more of an IOC (just as soon as I get some more time).


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring


-----Original Message-----
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 11:25 AM
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an abstract
>execute method that does not pass the request object.
>The subclasses overide the execute method without the request object being
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting --
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-----Original Message-----
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind of
>code even when the name is a property of the form object and is available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can be
>enforced. Is there quick way I can remove all the params/attributes from
the
>request object once the corresponding values have been set in the form
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to