Sounds like a lot of work that hyperlinks w/ diverging URIs or 
querystrings can accomplish, IMHO.  

But to answer your question:

The action-form associated with this action will need a property 
named "joe".  

The jsp page's <input> buttons need a name of "joe", and a value
of whatever you want rendered ("Single", "Batch", blah blah)

The action class will test the ActionForm.joe to see if it has 
a value of "Single" or "Batch".

This doesn't account for when people access the action without 
clicking either form.

HTH,
-dave
> -----Original Message-----
> From: davargas123 [mailto:davargas...@gmail.com] 
> Sent: Wednesday, December 09, 2009 3:21 PM
> To: user@struts.apache.org
> Subject: Simple two button form - Struts 1.2.x
> 
> 
> I am putting in page that loads at the beginning of my 
> application, and all
> it has two buttons that should end up forwarding to do one of 
> two different
> actions. How can I distinguish between which button has been 
> pushed inside
> the Action class so that I can forward it to the correct 
> page? The JSP and
> Action are as follows, so far:
> 
> 
> JSP: 
> 
> <%...@taglib uri="/taglib/struts-html" prefix="html"%>
> <%...@taglib uri="/taglib/struts-bean" prefix="bean"%>
> 
> 
> <html:form method="post" action="/SSNChoose" >
>       <bean:define id="ssnLookupForm" name="ssnLookupForm"
> type="com.thomson.west.pubrec.optout.ui.form.SSNLookupForm" />
>       <div style="text-align: center; font-family: arial;">
>           <div class="productsdiv" style="margin: 0 auto; 
> padding: 5px;
> text-align: left;">
>               <input type="submit" name="Single Encryption"
> value="Single-Encryption"/>
>               <div class="spacer">&nbsp;</div>
>               <input type="submit" name="Batch Encryption"
> value="Batch-Encryption"/>
>               </div>
>               <div class="spacer">&nbsp;</div>
>       </div>
> </html:form>
> 
> 
> Java class:
> 
> public class SSNChooseAction extends Action{
> 
>       private static final Logger log =
> Logger.getLogger(SSNChooseAction.class.getName());
>       
>       public ActionForward execute( ActionMapping mapping, 
> ActionForm form,
> HttpServletRequest request,
>                                                               
> HttpServletResponse  response){
>       
>               ActionForward fwd = null;
>               
>               if(<Some code that can tell me which button is 
> pressed>){
>                       fwd = mapping.findForward("single");
>               }else{
>                       fwd = mapping.findForward("batch");
>               }
>               
>               
>               return fwd;
>       }
>       
> }
> 
> -- 
> View this message in context: 
> http://old.nabble.com/Simple-two-button-form---Struts-1.2.x-tp
26716992p26716992.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
Notice:  This e-mail message, together with any attachments, contains 
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New 
Jersey, USA 08889), and/or its affiliates Direct contact information for 
affiliates is available at http://www.merck.com/contact/contacts.html) that may 
be confidential, proprietary copyrighted and/or legally privileged. It is 
intended solely for the use of the individual or entity named on this message. 
If you are not the intended recipient, and have received this message in error, 
please notify us immediately by reply e-mail and then delete it from your 
system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to