You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Berke, Wayne [IT]" <wa...@citigroup.com> on 2004/04/30 16:49:42 UTC

Indexed properties working formbean->htmlform, not working htmlform->formbean

I've been tearing my hair out trying to get indexed properties
to work.  Apparently, there is some correspondence between the HTML
fields and the ActionForm indexed properties because when the ActionForm
is initialized, it does correctly populate the default HTML form fields.
However, when I modify an HTML field that corresponds to an indexed
property and submit the form, that change does not get reflected in
the ActionForm.

I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems
like the correct setProperty calls are being made, but printing out the
ActionForm fields shows no change from the defaults.

Any information, including suggestions for how to further debug this
would be greatly appreciated.

My JSP looks like this:

<table width="770" border="0" cellspacing="0" cellpadding="0" class="bglt3">
	<html:form action="/IS">
	<logic:iterate name="isForm" id="isf" property="fundInfo" indexId="ix">
	<tr>
		<td width="45%" valign="middle">NM:</strong>&nbsp;
			<html:text name="isf"
				property="colName" indexed="true" size="10" styleClass="t11" />
					&nbsp;&nbsp;
		<td width="45%" valign="middle">DISP:</strong>&nbsp;
			<html:text name="isf"
				property="displayName" indexed="true" size="10" styleClass="t11" />
					&nbsp;&nbsp;
	</tr>
	</logic:iterate>
	<tr><td>
	<html:submit /></td></td>
	</html:form>
</table>

The ActionForm is:

public class ISF extends ActionForm {

	private List fundInfo = new ArrayList();
	{
		System.out.println("INITIALIZING!!!!!!!!!");
		fundInfo.add(new FundamentalsInfo("ONE", "1"));
		fundInfo.add(new FundamentalsInfo("TWO", "2"));
		fundInfo.add(new FundamentalsInfo("THREE", "3"));
	}
	public List getFundInfo() {
		return fundInfo;
	}
	public void setFundInfo(List fi) {
		fundInfo = fi;
	}
	public FundamentalsInfo getFundInfo(int index) {
		return (FundamentalsInfo) fundInfo.get(index);
	}
	public void setFundInfo(int index, FundamentalsInfo fi) {
		fundInfo.set(index, fi);
	}

	public void reset(ActionMapping mapping, HttpServletRequest request) {	
	}
}

A FundamentalsInfo object is just a simple bean with two attributes, colName and
displayName.

The associated Action simply prints out the contents of the fundInfo list and it
shows that the fields never change from the values they were initialized with.

Wayne

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