Hi
This is the real deal this time. This is the real code extract
instead of something made up.
==================
public class AccountAdminControllerForm extends ActionForm ...
{
/** Map of currency codes to user cashflow limit objects */
private Map mapLimits = new TreeMap();
public UserCashflowLimit getCashflowLimit( String ccyCode )
{
System.out.println( "AACF.getCashflowLimit("+ccyCode+")");
return (UserCashflowLimit) mapLimits.get( ccyCode );
}
public void setCashflowLimit( String ccyCode, UserCashflowLimit limit )
{
System.out.println( "AACF.setCashflowLimit("+ccyCode+", "+limit+")");
mapLimits.put( ccyCode, limit );
}
...
}
public class UserCashflowLimit {
private BigDecimal cashflowAmount=null;
private String amountText = null;
public BigDecimal getCashflowAmount()
{ return cashflowAmount; }
public void setCashflowAmount( BigDecimal cashflowAmount )
{ this.cashflowAmount = cashflowAmount; }
public String getAmount()
{ return amountText }
public void setAmount( String amountText )
{
System.out.println( "UCL.setAmount("+amountText+")" );
this.amountText = StringUtil.notNull(amountText);
}
...
}
Here is the real JSP code
<html:form action="/AccountAdminController.do" method="POST" >
...
<html:text property="cashflowLimit(USD).amountText" >
<bean:write name="accountAdminControllerForm"
property="cashflowLimit(USD).cashflowAmount" />
</html:text>
...
</html:form>
==================
I am still have problems with the actual signature. This is what the Javadoc for
`PropertyUtils' has to say
* <li><strong>Mapped (<code>name(key)</code>)</strong> - The JavaBean
* is assumed to have an property getter and setter methods with an
* additional attribute of type <code>java.lang.String</code>.</li>
Does this mean the `PropertyUtils' only supports property values that are
`java.lang.String' types?
public String getSomeAttribute( String key )
pubic void setSomeAttribute( String key, String values )
I know the property key have to be `java.lang.String' ?
--
Peter Pilgrim ++44 (0)207-545-9923
............................................ Swamped under electronic mails
---------------------------------------- Message History
----------------------------------------
From: [EMAIL PROTECTED] (David M. Karr) on 04/04/2002 13:34 PST
Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: Re: RequestUtils.populate ( BeanUtils.populate)
>>>>> "Peter" == Peter Pilgrim <[EMAIL PROTECTED]> writes:
Peter> In Struts 1.1
Peter> RequestUtils.populate ( BeanUtils.populate) does not seem to be populate
Peter> my action forms which explicityly have a mapped attributes.
Peter> I defined a bean like this
Peter> public CcyItem getCurrenyItem( String ccy ) {
Peter> return (CcyItem)mapItem.ge( ccy );
Peter> In my JSP I wrote a HTML Input Text field like so
Peter> <html:text property="currencyItem(USD).amountAsText" size="10"
maxlength="20" />
Peter> but it does not work because I think that Struts 1.1 does not populate
mapped properties!
Peter> Is it me or is it Struts?
Peter> Can someone else verify that it is working?
Just in case, did you paste in this code from your actual code, or did you type
it in directly? If this is pasted from your code, then you might want to
change "getCurrenyItem" to "getCurrencyItem".
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
This e-mail may contain confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please notify the sender
immediately and destroy this e-mail. Any unauthorized copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>