The return string of any Action is entirely configurable and up to you.
It just has to match whatever you've configured the view to.  So in this
case, instead of returning 'success', have this action be able to return
'edit' or 'remove', depending on the value of the submit button (and of
course whether the action was successful or not).  Like this:

class RemoveOrEditAction extends Action {

private String submit ; // setter omitted for brevity

public String doExecute() {
  if( "edit".equals(submit) ) {
    // maybe do stuff
    return "edit" ;
  }

  else if( "remove".equals(submit) ) {
    // do the removal
    return "remove" ;
  }

}

}

In view.properties, the relevant snippet would be something like:

removeOrEdit.edit = edit.jsp
removeOrEdit.remove = samePage.jsp


rachel

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Greinke, Ross
Sent: Wednesday, July 09, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] Multiple submit actions


Here's a question related to performing more than one successful submit
action in a form:

I have a form that contains a list of items (shown in a ui:select list).
The form contains two submit buttons, one to edit the selected item, one
to remove the item. Handling remove is easy.  The form submits to an
action whose doExecute method removes the item. Successfully handling
this case (view.properties) is to go back to the same page. Edit is
hard. I'd like to forward to another page with a separate form to edit
the data for the select item. My action can't do two separate "success"
ful things. I don't want to have two separate forms, since the item to
act upon is chosen in the one form for both.

Any ideas?

Rossi




-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to