struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claire Wall" <>
Subject Re: How do you submit a page and not change values
Date Mon, 02 Feb 2004 09:42:27 GMT
you can use the <html:submit> and <html:cancel> buttons from within a form.
They will both actually submit the form to an action, but it is possible to
capture the 'cancel' event in your action and therefore forward the user to
different places depending upon which one they clicked on.

so, for example, say you had a form with one field called 'name' and two
buttons- one 'cancel' and one 'submit'...

<html:form action="/saveDetails">

<html:text name="DetailsForm" property="name"/>



in struts-config you define your actions and where you wish to forward to
depending on which button the user clicked on:

  <action input="/xxx.jsp" name="DetailsForm" path="/saveDetails"
   scope="request" type="" validate="false">
   <forward name="success" path="/xxx.jsp" />
    <forward name="cancel" path="/yyy.jsp" />

and, finally, in your action you can catch the cancel event and forward to
the other place like so:

    return mapping.findForward("cancel");

    return mapping.findForward("success");

I hope that this answers your question - if not then sorry if i am just
repeating stuff that you already know! :)

Claire :)

----- Original Message -----
From: "Hunt, Steve" <>
To: "'Struts Users Mailing List'" <>
Sent: Monday, February 02, 2004 9:06 AM
Subject: How do you submit a page and not change values

> If you use either html:button, html:submit or html:cancel buttons they
> generate <input type="button"> html.
> So how can you create a screen for example with 1 field and 2 buttons, a
> submit and a do Not Submit button, both of which navigate the user to a
> results screen?
> Regards
> Steve
> =======================================================
> This message contains information that may be privileged or confidential
and is the property of the Cap Gemini Ernst & Young Group. It is intended
only for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.
> =======================================================
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message