Hi Konstantina,

I don;t know if you have a solution yet, but I have two separate ones for
you. The first is more struts oriented. If you have the following in your
JSP:

<!-- JSP Snippet-->
<html:submit property="btnProcess">
        <bean:message key="button.processSuspends" />
</html:submit>
<html:submit property="btnViewOrg">
        <bean:message key="button.viewOrg" />
</html:submit>
<html:submit property="btnViewProd">
        <bean:message key="button.viewProd" />
</html:submit>
<!-- End of JSP Snippet-->


//you need to create 3 attributes in your "ActionForm" object that's being
populated when this form gets submitted, called 
// with associated getters and setters...
boolean btnProcess, btnViewOrg, btnViewProd;

// then in the Action.perform(), simply look at the variables to see which
one is true....
boolean isProcess=false, isViewProd=false, isViewOrg=false;

// Get and cast a reference to the ActionForm object for use
MyActionForm theForm=(MyActionForm)form;
   
// What button was pushed
String process =
(theForm.getBtnProcess().equals(null)?"":theForm.getBtnProcess());
String viewOrg =
(theForm.getBtnViewOrg().equals(null)?"":theForm.getBtnViewOrg());
String viewProd =
(theForm.getBtnViewProd().equals(null)?"":theForm.getBtnViewProd());

The following code will also work

// Getting what button was pressed looping through parameters 
String button_pressed = null;
Enumeration e = request.getParameterNames();
while (e.hasMoreElements()) {
    String param = (String) e.nextElement();
    if (param.startsWith("btn")) {
        button_pressed = param;
        break;
    }
}
System.out.println("button_pressed="+button_pressed);

John Mattos
Sr. Developer and Architect
iNDEMAND
345 Hudson St. 16th Floor
New York, New York
10014

-----Original Message-----
From: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 5:02 AM
To: Struts Users Mailing List
Subject: html:submit button


Hello,
I have a problem and I can't fingure out the solution to it. Here is my
case:

I have a list of products (PoductBean) on my .jsp and each one of it have
two buttons (html:submit)  :

Button1 --> Display Information for this product
Button2 --> Use the information to do something else

My question is: How can I decide which product has been selected so as to
display its information on my next page? 
>From what I have seen the html:submit tag does not contain any attributes to
pass request parameters.

Thank U in advance,
Konstantina






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to