You probably meant :

        public void setId(String id){
        this.id = Integer.parseInt(id);
}
        
        Regards, 
                Dimitar
-----Original Message-----
From: Phase Web and Multimedia [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 11, 2002 4:57 PM
To: Struts Users Mailing List
Subject: RE: Please help.

That would have to happen in the bean the String is being passed to. Go
ahead and receive the String and set it to an integer something like the
following:

You should read the spec on bean usage. My solution may not be standard and
may break some containers. But, I'm not sure of any other way. It has always
worked for me.


protected int id;

public void setId(String id){
        this.id = String.valueOf(id);
}

public int getId(){
        return id;
}

-----Original Message-----
From: Ajay Mallik [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 3:12 PM
To: 'Struts Users Mailing List'
Subject: Please help.


Hi,
I am new to struts. I want to use Struts' Digester to parse my xml file. I
want to know if the
digester can set the attributes of the xml element to the fields in the
corresponding class whose type are other than string. Let's say,

<my_xml id="01" name="foo"/>

and my class has a field like:

public class MyClass{
int id;
String name;
....
}

then when the digester sets the attribute with addSetProperties, will it set
the id as the NUMERIC value of the string "01" ?
If not, is there any way to do that using digester?

I would highly appreciate your help.

Thanks
Ajay

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



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

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

Reply via email to