That's it!
Thanks will try that!

mm

> -----Original Message-----
> From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 10:18 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Reusing the same HTML Form for many actions
>
>
>
> I see now you problem of the action name in JSP needs to change.
>
> So then add a request parameter in the action which gives the action name
> and then do something like:
>
> <html:form action='<%=request.getAttribute("nextAction")%>' >
>
> or something similar.  You should always go through an action to
> a JSP so do
> your dirty work there of creating a var to pass.
>
> -----Original Message-----
> From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 4:10 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Reusing the same HTML Form for many actions
>
>
> I don't agree that these things are two COMPLETELY different
> things.  Adding
> a User and editing a Group might be two completely different things but in
> the one case a adding a User and editing a User are very similar.  Passing
> almost the same field value pairs to the middle tier to do something with
> them.
>
> Then DispatchAction never has a place to exist if all things exactly the
> same must be in an action.
>
> Anyway, so thought you were doing something more complicated because the
> answer then is simple:
>
>  struts config:
>      <action    path="/addUser"
>           type="my.web.action.AddUserAction"
>           name="userForm"
>           input="doc.userForm"
>           scope="request">
>           <forward name="showUserForm"  path="doc.userForm"/>
>           <forward name="showConfirm"  path="doc.addUserConfirm"/>
>      </action>
>
>      <action    path="/editUser"
>           type="my.web.action.UpdateUserAction"
>           name="userForm"
>           input="doc.userForm"
>           scope="request">
>           <forward name="showUserForm"  path="doc.userForm"/>
>           <forward name="showConfirm"  path="doc.updateUserConfirm"/>
>      </action>
>
> Now both actions are using the same form and same JSP (or definition).
>
> Well then you say, "My validation is slightly different between
> the two" or
> something like that I suppose.
>
> Then make sure your actions extend ValidatorActionForm so that
> you can base
> your validation for the userForm per action name coming in.
>
> validation.xml:
>
> <form name="/addUser">
>  <!-- do validation one way for this action but same form ->
> </form>
> <form name="/editUser">
>  <!-- do validation one way for this action but same form ->
> </form>
>
>
> Am I missing something here?
>
>
>
> -----Original Message-----
> From: Michal Maczka [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 4:03 PM
> To: Struts Users Mailing List
> Subject: RE: Reusing the same HTML Form for many actions
>
>
>
> > -----Original Message-----
> > From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 03, 2003 8:23 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Reusing the same HTML Form for many actions
> >
> >
> >
> > I would do something a little more code but less confusing.
> > This is just a guess I don't have this working:
> >
>
> I have completely different measure: it is less code but it is more
> confusing.
>
> Why should I use the same action for making two completely
> different things?
> Isn't it more clear IMHO  to make separate action for each "command".
>
> I would really like to use forms as a black box components which can be
> configured.
> (e.g. associated with different actions).
>
> Is it possible?
>
> Michal
>
>
> > JSP:
> > <html:form action="/addOrUpdateUser" >
> >
> > <html:hidden property="todo" value="<set this how you want>" />
> > the value above is which method in your DispatchAction to go to
> > as in add or
> > update.
> >
> >
> > struts config:
> >     <action    path="/addOrUpdateUser"
> >         parameter="todo"
> >         type="my.web.action.AddUpdateUserAction" <--extends
> > DispatchAction
> >         name="updateUserForm"
> >         input="doc.userForm"
> >         validate="true"
> >         scope="request">
> >         <forward name="showUserForm"  path="doc.UserForm"/>
> >         <forward name="showConfirm"  path="doc.updateUserConfirm"/>
> >     </action>
> >
> >
> >
> > Action class:
> > class AddUpdateUserAction extends DispatchAction
> > {
> >
> >
> > public ActionForward add(...)
> > {
> >     //code for adding a user
> > }
> >
> > public ActionForward update(...)
> > {
> >     //code for adding a user
> > }
> >
> >
> > }
> >
> >
> >
> >
> > -----Original Message-----
> > From: Michal Maczka [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 03, 2003 1:21 PM
> > To: [EMAIL PROTECTED]
> > Subject: Reusing the same HTML Form for many actions
> >
> > Can somebody explain me what is the best practice if I want to
> > use the same
> > form (JSP page/fragment)
> > for executing different action.
> >
> > For example I want to have "add" and "edit" action which will
> be processed
> > differently,
> > but the form for entering data will be the same.
> >
> > I tried to use form as >>Tiles<< and do something like:
> >
> > <html:form action="<tiles:getAsString name="action"/>" focus="name"
> > onsubmit="return validateXXForm(this)">
> >
> > but this does not seems to works.
> >
> > any suggestions?
> >
> > Michal
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> >
> >
> > ----------------------------------------------------------------------
> > Sportowy portal INTERIA.PL >>> http://link.interia.pl/f1730
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ----------------------------------------------------------------------
> Komputerowy portal INTERIA.PL >>> http://link.interia.pl/f172f
>
>
>



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

Reply via email to