You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jordan Reed <jo...@hotmail.com> on 2003/04/05 05:30:49 UTC

Retrieve a Submit Value in a Form Bean

All,

I'm working on updating my Struts app from 1.0.1 to 1.1RC1 and hit some
unexpected behavior.  I wanted to know if this made sense.

I have a form with multiple <html:submit> tags in it, each having a
different value.  The form bean associated with it has a submit property.

In Struts 1.0.1 I was able to call getSubmit() and it would give me back the
value of which submit button pressed.  In Struts 1.1RC1 the value is null,
which implies that Struts is never setting the value.  

Is this expected?  If so, how can I get back the value of the submit?

Thanks,
Jordan


Form:
<logic:iterate id="misc" name="userManager" property="userMiscs">
  <html:form action="/updateMisc">
    <html:hidden name="misc" property="miscId"/>
    <tr>
      <td><html:text name="misc" property="miscName" size="25"/></td>
      <td><html:text name="misc" property="miscValue" size="50"/></td>
      <td><html:submit value="Update"/></td>
      <td><html:submit value="Delete"/></td>
    </tr>
  </html:form>
</logic:iterate>

FormBean:
public class UpdateUserMiscForm extends ActionForm {
	protected String miscId;
	protected String miscName;
	protected String miscValue;
	protected String submit;

	public void setMiscId(String miscId) {
		this.miscId = miscId;
	}

	public String getMiscId() {
		return this.miscId;
	}

	public void setMiscName(String miscName) {
		this.miscName = miscName;
	}

	public String getMiscName() {
		return this.miscName;
	}

	public void setMiscValue(String miscValue) {
		this.miscValue = miscValue;
	}

	public String getMiscValue() {
		return this.miscValue;
	}

	public void setSubmit(String submit) {
		this.submit = submit;
	}

	public String getSubmit() {
		return this.submit;
	}
}

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