Re: AW: recognizing a button
Hi Bernhard. Personally, I use two additional methods within the ActionForm: public void setLoadPressed(boolean loadPressed) { m_loadPressed = loadPressed; } public void setSubmitPressed(boolean submitPressed) { m_submitPressed = submitPressed; } which I call from the Action.perform method after having finished my processing. Terence "Bernhard J. Hirschmann" wrote: > Hello Terence, > > thanks for that, that's great. > > > Don't forget to reset the boolean values when you redisplay the form! > > How do I do this the best way? Simply calling > "form.reset(mapping, request)" > in my action class doesn't work. I shouldn't call the setters directly, > right? > > Best regards, > Bernhard > > > -Ursprungliche Nachricht- > > Von: Terence Jacyno [mailto:[EMAIL PROTECTED]] > > Gesendet: Donnerstag, 9. August 2001 13:11 > > An: [EMAIL PROTECTED] > > Betreff: Re: recognizing a button > > > > > > Hi. > > > > If you want to figure out which button was pressed directly within your > > ActionForm, try this. > > > > Within the ActionForm that you associated with your HTML form, place the > > following: > > > > public void MyActionForm extends ActionForm { > > protected boolean m_loadPressed = false; > > protected boolean m_submitPressed = false; > > > > ... > > > > public void setLoad(String load) { > > m_loadPressed = true; > > } > > public boolean isLoadPressed() { > > return m_loadPressed; > > } > > > > public void setSubmit(String submit) { > > m_submitPressed = true; > > } > > public boolean isSubmitPressed() { > > return m_submitPressed; > > } > > > > ... > > > > } > > > > Now you can access which button was pressed by consulting the > > corresponding methods within the ActionForm passed to the Action.perform > > method. > > > > Don't forget to reset the boolean values when you redisplay the form! > > > > Terence > > > > > > William Jaynes wrote: > > > > > String loadButton = (String)request.getParameter("load"); > > > String submitButton = (String)request.getParameter("submit"); > > > > > > - Original Message - > > > From: "Bernhard J. Hirschmann" <[EMAIL PROTECTED]> > > > To: "Struts-User" <[EMAIL PROTECTED]> > > > Sent: Thursday, August 09, 2001 6:26 AM > > > Subject: recognizing a button > > > > > > Hello! > > > > > > How can I recognize in the ActionServlet, which button was pressed? > > > I have this two buttons: > > > > > > > > > > > > > > > How can I get the value of the attribute "property" inside of the > > > Action.perform method? I just can't figure out, which method to use. > > > > > > Thanks in advance, > > > Bernhard > > > >
AW: recognizing a button
Hello Terence, thanks for that, that's great. > Don't forget to reset the boolean values when you redisplay the form! How do I do this the best way? Simply calling "form.reset(mapping, request)" in my action class doesn't work. I shouldn't call the setters directly, right? Best regards, Bernhard > -Ursprungliche Nachricht- > Von: Terence Jacyno [mailto:[EMAIL PROTECTED]] > Gesendet: Donnerstag, 9. August 2001 13:11 > An: [EMAIL PROTECTED] > Betreff: Re: recognizing a button > > > Hi. > > If you want to figure out which button was pressed directly within your > ActionForm, try this. > > Within the ActionForm that you associated with your HTML form, place the > following: > > public void MyActionForm extends ActionForm { > protected boolean m_loadPressed = false; > protected boolean m_submitPressed = false; > > ... > > public void setLoad(String load) { > m_loadPressed = true; > } > public boolean isLoadPressed() { > return m_loadPressed; > } > > public void setSubmit(String submit) { > m_submitPressed = true; > } > public boolean isSubmitPressed() { > return m_submitPressed; > } > > ... > > } > > Now you can access which button was pressed by consulting the > corresponding methods within the ActionForm passed to the Action.perform > method. > > Don't forget to reset the boolean values when you redisplay the form! > > Terence > > > William Jaynes wrote: > > > String loadButton = (String)request.getParameter("load"); > > String submitButton = (String)request.getParameter("submit"); > > > > - Original Message - > > From: "Bernhard J. Hirschmann" <[EMAIL PROTECTED]> > > To: "Struts-User" <[EMAIL PROTECTED]> > > Sent: Thursday, August 09, 2001 6:26 AM > > Subject: recognizing a button > > > > Hello! > > > > How can I recognize in the ActionServlet, which button was pressed? > > I have this two buttons: > > > > > > > > > > How can I get the value of the attribute "property" inside of the > > Action.perform method? I just can't figure out, which method to use. > > > > Thanks in advance, > > Bernhard > >
Re: recognizing a button
Hi. If you want to figure out which button was pressed directly within your ActionForm, try this. Within the ActionForm that you associated with your HTML form, place the following: public void MyActionForm extends ActionForm { protected boolean m_loadPressed = false; protected boolean m_submitPressed = false; ... public void setLoad(String load) { m_loadPressed = true; } public boolean isLoadPressed() { return m_loadPressed; } public void setSubmit(String submit) { m_submitPressed = true; } public boolean isSubmitPressed() { return m_submitPressed; } ... } Now you can access which button was pressed by consulting the corresponding methods within the ActionForm passed to the Action.perform method. Don't forget to reset the boolean values when you redisplay the form! Terence William Jaynes wrote: > String loadButton = (String)request.getParameter("load"); > String submitButton = (String)request.getParameter("submit"); > > - Original Message - > From: "Bernhard J. Hirschmann" <[EMAIL PROTECTED]> > To: "Struts-User" <[EMAIL PROTECTED]> > Sent: Thursday, August 09, 2001 6:26 AM > Subject: recognizing a button > > Hello! > > How can I recognize in the ActionServlet, which button was pressed? > I have this two buttons: > > > > > How can I get the value of the attribute "property" inside of the > Action.perform method? I just can't figure out, which method to use. > > Thanks in advance, > Bernhard
AW: recognizing a button
Hallo Bernhard, with String property = request.getParameter("load") you save "Load" in the String property Stefan > -Ursprüngliche Nachricht- > Von: Bernhard J. Hirschmann [mailto:[EMAIL PROTECTED]] > Gesendet: Donnerstag, 9. August 2001 12:26 > An: Struts-User > Betreff: recognizing a button > > > Hello! > > How can I recognize in the ActionServlet, which button was pressed? > I have this two buttons: > > > > > How can I get the value of the attribute "property" inside of the > Action.perform method? I just can't figure out, which method to use. > > Thanks in advance, > Bernhard > >
Re: recognizing a button
String loadButton = (String)request.getParameter("load"); String submitButton = (String)request.getParameter("submit"); - Original Message - From: "Bernhard J. Hirschmann" <[EMAIL PROTECTED]> To: "Struts-User" <[EMAIL PROTECTED]> Sent: Thursday, August 09, 2001 6:26 AM Subject: recognizing a button Hello! How can I recognize in the ActionServlet, which button was pressed? I have this two buttons: How can I get the value of the attribute "property" inside of the Action.perform method? I just can't figure out, which method to use. Thanks in advance, Bernhard
recognizing a button
Hello! How can I recognize in the ActionServlet, which button was pressed? I have this two buttons: How can I get the value of the attribute "property" inside of the Action.perform method? I just can't figure out, which method to use. Thanks in advance, Bernhard