You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Cordingley, Charles" <Ch...@rbs.co.uk> on 2003/08/01 19:23:45 UTC

Using Struts Validator on Map-backed ActionForms

Hi,

I am trying to use the Struts Validator to generate Javascript validation on
a Map-backed action form, but I keep getting "type is null or not an object"
javascript error (I am using Struts 1.1). Non map-backed properties on the
form work fine.

In the JSP I am creating text boxes using:

<html:text style="WIDTH: 75px; text-align: right"
property='<%="volume("+act.getActivityID()+")"%>'
value='<%=""+scenAct.getActivityVolume()%>'/>

and have this method on the action form to get it:

public void setVolume(String key, Object value) {
   volumes.put(key, value);
}

In the validation.xml I have tried:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

and:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

but both result in the error.

Does anyone know how to do this?

Thanks,
Charles.



The Royal Bank of Scotland plc ('the Bank') is regulated by the Financial 
Services Authority and is a member of The Royal Bank of Scotland Marketing
Group.  The only packaged products (life policies, unit trusts and other
collective investment schemes and stakeholder and other pensions) the Bank
advises on and sells are those of the Marketing Group, whose other members
are Royal Scottish Assurance plc and Royal Bank of Scotland Unit Trust
Management Limited, both regulated by the Financial Services Authority.

The Royal Bank of Scotland plc. Registered in Scotland No 90312.  Registered
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 

Agency agreements exist between members of The Royal Bank of Scotland Group.

This e-mail message is confidential and for use by the addressee only. If
the message is received by anyone other than the addressee, please return
the message to the sender by replying to it and then delete the message from
your computer. Internet e-mails are not necessarily secure. The Royal Bank
of Scotland plc does not accept responsibility for changes made to this
message after it was sent. 

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the onward
transmission, opening or use of this message and any attachments will not
adversely affect its systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry out
such virus and other checks as it considers appropriate.


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


RE: Using Struts Validator on Map-backed ActionForms

Posted by Yansheng Lin <ya...@isogis.com>.
I don't think this is legal, i.e., you can not have a bracket inside of property
attribute:

	<field property="volume()"

You form should have the getter method for getVolume().  


-----Original Message-----
From: Cordingley, Charles [mailto:Charles.Cordingley@rbs.co.uk] 
Sent: August 1, 2003 11:24 AM
To: 'struts-user@jakarta.apache.org'
Subject: Using Struts Validator on Map-backed ActionForms


Hi,

I am trying to use the Struts Validator to generate Javascript validation on
a Map-backed action form, but I keep getting "type is null or not an object"
javascript error (I am using Struts 1.1). Non map-backed properties on the
form work fine.

In the JSP I am creating text boxes using:

<html:text style="WIDTH: 75px; text-align: right"
property='<%="volume("+act.getActivityID()+")"%>'
value='<%=""+scenAct.getActivityVolume()%>'/>

and have this method on the action form to get it:

public void setVolume(String key, Object value) {
   volumes.put(key, value);
}

In the validation.xml I have tried:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

and:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

but both result in the error.

Does anyone know how to do this?

Thanks,
Charles.



The Royal Bank of Scotland plc ('the Bank') is regulated by the Financial 
Services Authority and is a member of The Royal Bank of Scotland Marketing
Group.  The only packaged products (life policies, unit trusts and other
collective investment schemes and stakeholder and other pensions) the Bank
advises on and sells are those of the Marketing Group, whose other members
are Royal Scottish Assurance plc and Royal Bank of Scotland Unit Trust
Management Limited, both regulated by the Financial Services Authority.

The Royal Bank of Scotland plc. Registered in Scotland No 90312.  Registered
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 

Agency agreements exist between members of The Royal Bank of Scotland Group.

This e-mail message is confidential and for use by the addressee only. If
the message is received by anyone other than the addressee, please return
the message to the sender by replying to it and then delete the message from
your computer. Internet e-mails are not necessarily secure. The Royal Bank
of Scotland plc does not accept responsibility for changes made to this
message after it was sent. 

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the onward
transmission, opening or use of this message and any attachments will not
adversely affect its systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry out
such virus and other checks as it considers appropriate.


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


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