Hi,

I run into problems with chaining dispatchactions using the same
parameter 'method'. We do use the same parameter name for all our
dispatchaction for consistency reasons throughout the whole application,
easier to maintain and using generique javascript functions.

The problem we ran into is that we have a first jsp page showing a list
of items, and we achieve that by prepopulating with a dispatchaction
some beans to be used in the jsp. 
Then we can go to a 'edit' page and when we submit we have another
dispatchaction with an 'update' method that should reforward on success
to the first prepoplation dispatchaction.
The problem is that forwarding calls the 'update' method from the
prepopulation dispatchaction, which does not exist and should not exist.
Redirecting the action does not work as I lose a request parameter that
permits to prepopulate the right list of products on my first page (It
will display the default list, not necesarely the list where he started
an update upon).

So, our action&page flow is the following:
Prepopulation Action --> list.jsp --> detail (product Action) -->
edit.jsp --> update (product action) --> Prepopulation Action.

Only options I see,
I could not use dispatchactions, but then I would have so many different
action classes that are so closely related and using common methods.
I could break our 'inhouse rule' of using one global parameter name for
dispatchactions, but it would not be clean to have an exception to the
rule, so I'm against that option.
I could put an object in the session and in my prepopulation action
testing for it, and if it exist showing the right list of products. But
again, it's simulating a request parameter using a session, which is not
a great design.
None of the three options above are good design to me, so I would prefer
another way.

What I would need is more something like the 'unspecified' method from
dispatchactions that would also be called if the given parameter does
not match any of the methods of the dispatchaction. From my tests, it's
not the case,  the 'unspecified' method is called when the 'parameter'
does not exist in the request and not when it does not match anny
methods (my case).
Or else, I would need a patameter 'overriding' mechanism, something
where the dispatchaction first do a request.getAttribute('method') and
if this one does not exist performs a request.getParameter('method').
But I have not found how to achieve one of boths terchniques.

I'm sure someone else ran into this issue too, and I am aware that
chaining actions is not a recommended design, but it's not a
bussinesslogic problem, the issues addressed here only concerns
presentation. Or did I missed something?


Thanks very much for your ideas,

 



Cosyns Xavier, 
______________________________ 
[EMAIL PROTECTED] 
 
InveO Consulting & Development
Av. E. de Beco 112
1050 Ixelles 
Tel: +32 2 648 74 32 
Fax: +32 2 648 87 64 




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

Reply via email to