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-tp26716992p26716992.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

Reply via email to