You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by William Jaynes <wj...@mediaone.net> on 2000/12/07 13:39:09 UTC

Re: CommandToken

Rob,
Thanks for the CommandToken zip file. Unfortunately, I see a problem with that
particular implementation, even though I understand why it was done that way.
Here's how I see it:

The command token needs to be reset every time, after the action.perform method,
but before the dispatch to the jsp. Currently these two things are bundled
together in the ActionServlet.processActionPerform() method. Your work-around
was to set the token in the command tag itself, which happens within a jsp. What
this means, however, is that for the token to be reset each time, the command
tag needs to be in every jsp whether it is needed or not. Normally the command
tag would be added only to sensitive pages that do things like inserts, updates,
deletes.

I seems that what we really need is for the processActionPerform method in
ActionServlet to be broken into two methods:

protected ActionForward processActionPerform(....)
    which only processes the perform method of the appropriate action class and
returns the ActionForward

protected void processActionForward(ActionForward af)
   which takes the ActionForward and does the dispatching

That way, if we need to do something between the perform and the forward (like
setting a command token) we can subclass ActionServlet and override
processActionPerform like

protected ActionForward processActionPerform(.....) {
    ActionForward af  = super.processActionPerform(....);
    CommandToken.set(request);
    return af;
}

Will


Re: CommandToken

Posted by Robert Leland <Ro...@freetocreate.org>.
I agree that a Event, Subscribe Publish, Metaphore would certainly
make the classes more usable.


> >Thanks for the CommandToken zip file. Unfortunately, I see a problem with that

Rob Leland Robert@freetocreate.org (+01-202-544-0533)



Re: CommandToken

Posted by Mike La Budde <mi...@irista.com>.
If you do break up processActionPerform() into two methods, what about 
implementing someone's previous suggestion/request for a (do nothing) 
processPostProcess() method? So the flow might be:

processActionPerform(...)
processPostProcess(...)
processActionForward(...)

Thanks,

Mike

At 12/07/2000 07:39 AM -0500, you wrote:
>Rob,
>Thanks for the CommandToken zip file. Unfortunately, I see a problem with that
>particular implementation, even though I understand why it was done that way.
>Here's how I see it:
>
>The command token needs to be reset every time, after the action.perform 
>method,
>but before the dispatch to the jsp. Currently these two things are bundled
>together in the ActionServlet.processActionPerform() method. Your work-around
>was to set the token in the command tag itself, which happens within a 
>jsp. What
>this means, however, is that for the token to be reset each time, the command
>tag needs to be in every jsp whether it is needed or not. Normally the command
>tag would be added only to sensitive pages that do things like inserts, 
>updates,
>deletes.
>
>I seems that what we really need is for the processActionPerform method in
>ActionServlet to be broken into two methods:
>
>protected ActionForward processActionPerform(....)
>     which only processes the perform method of the appropriate action 
> class and
>returns the ActionForward
>
>protected void processActionForward(ActionForward af)
>    which takes the ActionForward and does the dispatching
>
>That way, if we need to do something between the perform and the forward (like
>setting a command token) we can subclass ActionServlet and override
>processActionPerform like
>
>protected ActionForward processActionPerform(.....) {
>     ActionForward af  = super.processActionPerform(....);
>     CommandToken.set(request);
>     return af;
>}
>
>Will