I don't want prepopulate the ActionForm entirely, but only of the parameter
 needed by the target Action, therefore the same parameter that it require
 from all pages that call it.
 I don't want replicate the code execute in a target action, because then i
 need then maintain it, test it, and moreover it don't prepopulate only the
 action forms but use several ejb to get other bean needed by the jsp.

 I want illustrate my design of a simple system for edit, insert, list
products for example to comprise my problem.

Start page is the list, from wich the user can do insert or edit.
I have four action:
1) /prepareInsert.do that did not receive parameter, make all necessary
calls to EJB to obtain list of values (html select) from wich the user
choose product attribute (for example the product category) and then forward
to the jsp with the insert forms.

2) /executeInsert.do that receive all data inserted from user, call the EJB
create method and read the assigned product Id (primary key with a
sequence).

3) /prepareModify.do that receive only the primary key and calls ejb lists,
execute hte ejbFind by primary key to obtain the value object and copy it on
the modifyActionForm and then forward to a jsp with the module for editing.

4) /executeModidy that receive all modified data and the primary key and
apply them on the db.


 The prepareModify.do was called from the list passing them the product id
with the regular framework workflow (a form submitted and the servlet that
call the populate method).
Also the executeInsert.do action need to forward to the prepareModify.do
because the functionality that i want do to the user is that after the
insert form, the system present the modify form, wich has more sections that
insert (in the same manner of the list).

I don't want to chain my action, i want pass control to another action in
the same manner that i do from a jsp page!!!

My current implementation of this feature is that the executeModify.do
populate an additional javabean (not the ActionForm of the prepareModify)
with the product id and then forward the control to the prepareModify. The
prepareModify (before another instruction) must check in the request to see
if exists this bean and then copy its values in the ActionForm, then execute
the common code.

What the framework must provide (for me) is a mechanism to provide forward
to another action in the same paradigm of the jsp that invoke actions (by
get or post), without requiring additional code on the target actions...
What do you think about this?

I think that the implementation of this feature is very simple:
-ActionForward with a collection (or a DynaBean) of parameters (only string
and string[] parameters like input fields on forms)
-processForward() on the servlet controller that uses this collection of
parameter calling a method similar to the populate method called on
requests.

I think that this feature can be very useful in the framework!!!
----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: "Struts Developers List" <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 11:18 PM
Subject: Re: DynaActionFormClass.getDynaActionFormClass


>
>
> On Thu, 9 Jan 2003, Franco Caponi wrote:
>
> > Date: Thu, 9 Jan 2003 18:39:05 +0100
> > From: Franco Caponi <[EMAIL PROTECTED]>
> > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > To: Struts Developers List <[EMAIL PROTECTED]>
> > Subject: Re: DynaActionFormClass.getDynaActionFormClass
> >
> > My previous post is not correct (excuse me)... because now i have
> > successfully called RequestUtils.createActionForm() with the cast
needed:
> > Code was correct,
> > My error was the mapping name that must not end with .do.
> >
> >
> > Problem is that when i have prepopulated the ActionForm, saved it on the
> > request and return the ActionForward that forward to another Action
class
> > (/prepareModify.do) the controller launch the new Action with the
ActionForm
> > cleared (I think that try to populate it from the request).
> >
>
> Why are you trying to chain actions here?  If you've already prepopulated
> the form bean, you can just forward directly to the JSP page that will
> display it.  This is exactly the sort of reason that I frown on chaining
> actions as a general technique in Struts -- it has unintended side effects
> if the actions you are using have form beans declared for them.
>
> The logic that creates the form bean and the logic that populates it
> should be in (or called by) the same action.
>
> Craig
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


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

Reply via email to