Hi Yusuf,

I had earlier posted for similar requirements but nobody replied and even I
check on some places on the net
about it, but it seems, there is nothing available.

so then I wrote some of the basic validators for mapped properties.
It seems to be working good.
let me know if you need it.

Is there anyone with same situation please post and let us know if there is
any existing thing?


Panchasheel


-----Original Message-----
From: Yusuf Kör [mailto:[EMAIL PROTECTED]
Sent: Friday, August 29, 2003 1:05 PM
To: [EMAIL PROTECTED]
Subject: validating mapped properties


Hallo,

I have a dynamic form with groups of input fields (string fields, 
integer fields, double fields .etc.).
If I validate these fields with struts validator, then the Validator 
Class throws the Exception: java.lang.NoSuchMethodException: Property 
'string' has no getter method.
Has somebody an idea what a did wrong or has somebody another solution 
for validating groups of  input fields? (The number and types of all the 
fields are dynamic)


Here is my example JSP:
------------------------------------------------
<html:form action="/UserAttributesWrite.do">

     <html:text property="string(1000)"   />
     <html:text property="string(1001)"  />
     <html:text property="integer(1002)"  />
     <html:text property="decimal(1003)"  />
     <html:text property="integer(1004)"  />
     <html:text property="string(1005)"   />

</html:form>


Here is my ActionForm:
----------------------------------------------
private HashMap string = new HashMap();
private HashMap integer = new HashMap();
private HashMap decimal = new HashMap();

public void setString(String key, Object value) {
        string.put(key, value);
}
public Object getString(String key) {
    return string.get(key);
}
public void setInteger(String key, Object value) {
    integer.put(key, value);
}
public Object getInteger(String key) {
    return integer.get(key);
}
public void setDecimal(String key, Object value) {
    decimal.put(key, value);
}
public Object getDecimal(String key) {
    return decimal.get(key);
}


Thats part of my validate.xml
--------------------------------------------------------
<form name="UserAttributesForm">

    <field property="integer" depends="integer">
        <arg0 key="integer" />
    </field> 

    <field property="decimal" depends="float">
        <arg0 key="decimal" />
    </field>    
           
</form>

Thanks
Yusuf





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to