I would do something a little more code but less confusing.
This is just a guess I don't have this working:
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]