You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jvleminc <jo...@advalvas.be> on 2008/01/08 19:02:29 UTC

Type conversion with Generics

Hello,

I am facing with automatic type conversion upon the submit of my Form:

Basically I have form fields with the names 
eoActivities[0].activityName
eoActivities[0].eoUser[0].eoUserId
eoActivities[0].eoUser[0].eoUserAddress[0].addressType
eoActivities[0].eoUser[0].eoUserAddress[0].name
...
eoActivities[0].eoUser[0].eoUserAddress[1].addressType
eoActivities[0].eoUser[0].eoUserAddress[1].name
...
eoActivities[0].eoUser[1].eoUserId
eoActivities[0].eoUser[1].eoUserAddress[0].addressType
eoActivities[0].eoUser[1].eoUserAddress[0].name
...
eoActivities[1].activityName
eoActivities[1].eoUser[0].eoUserId
eoActivities[1].eoUser[0].eoUserAddress[0].addressType
eoActivities[1].eoUser[0].eoUserAddress[0].name
...
and so on

I would like that the values of these form elements are automatically
inserted into the following object:
Set<EoActivity>
with EoActivity a bean with two members variables:
  activityName and Set<EoUser> and appropriate getter and setter,
  with EoUser a bean with two members variables:
    eoUserId and Set<EoUserAddress> and appropriate getter and setter, 
    with EoUserAddress a bean with member variables addressType and name

Is this possible? Right now I receive a lot of 
17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
[setParameters]: Unexpected Exception caught setting
'eoActivities[0].eoUser[0].eoUserId' on 'class
com.datamat.care.actions.EoActivitiesAction: Error setting expression
'eoActivities[0].eoUser[0].eoUserId' with value
'[Ljava.lang.String;@1aa4bb4'
 errors ;-(
Thanks in advance!

Joris

-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by ravi_eze <ra...@yahoo.com>.
hey! one thing btw: when u say something[0] how can it be represented in set/
map as the order is not maintained?  

and one more thing: *-conversion.prop does it work for a custom object in
the action class (struts2) (i.e. i had seen fromString being called but not
toString method ) any help



rickcr wrote:
> 
> Yup Maps will work also.
> 
> On Jan 8, 2008 1:57 PM, Dave Newton <ne...@yahoo.com> wrote:
> 
>> I've never used Sets, only Maps, which definitely work...
>>
>> As a sanity check perhaps you could try using a Map. I know you can get a
>> Set
>> view of a Map, so perhaps this is an alternative solution (I'm not so
>> sure
>> about going the other direction, however).
>>
>> This would at least narrow down the problem to see if it's a Set v. Map
>> issue.
>>
>> d.
>>
>> --- jvleminc <jo...@advalvas.be> wrote:
>>
>> >
>> > I know. Unfortunately i can't change my business beans anymore :-(
>> Anyway,
>> > any other ideas? I am trying now with a
>> EoActivities-conversion.properties
>> > file, containing
>> >
>> > Element_eoActivity = com.datamat.care.bean.EoActivity
>> > Element_eoUser = com.datamat.care.bean.EoUser
>> > Element_eoUserAddress = com.datamat.care.bean.EoUserAddress
>> >
>> >
>> > but no avail yet...thanks anyway!
>> >
>> >
>> >
>> > rickcr wrote:
>> > >
>> > > At least in Struts1.1, If I'm not mistaken, you aren't going to be
>> able
>> > to
>> > > use indexed properties like you are to set items in a Set. If you use
>> > > Lists
>> > > it would be much easier to accomplish the nested collection
>> population.
>> > >
>> > > On Jan 8, 2008 1:02 PM, jvleminc <
>> joris.vleminckx.advalvas1@advalvas.be>
>> > > wrote:
>> > >
>> > >>
>> > >> Hello,
>> > >>
>> > >> I am facing with automatic type conversion upon the submit of my
>> Form:
>> > >>
>> > >> Basically I have form fields with the names
>> > >> eoActivities[0].activityName
>> > >> eoActivities[0].eoUser[0].eoUserId
>> > >> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
>> > >> eoActivities[0].eoUser[0].eoUserAddress[0].name
>> > >> ...
>> > >> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
>> > >> eoActivities[0].eoUser[0].eoUserAddress[1].name
>> > >> ...
>> > >> eoActivities[0].eoUser[1].eoUserId
>> > >> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
>> > >> eoActivities[0].eoUser[1].eoUserAddress[0].name
>> > >> ...
>> > >> eoActivities[1].activityName
>> > >> eoActivities[1].eoUser[0].eoUserId
>> > >> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
>> > >> eoActivities[1].eoUser[0].eoUserAddress[0].name
>> > >> ...
>> > >> and so on
>> > >>
>> > >> I would like that the values of these form elements are
>> automatically
>> > >> inserted into the following object:
>> > >> Set<EoActivity>
>> > >> with EoActivity a bean with two members variables:
>> > >>  activityName and Set<EoUser> and appropriate getter and setter,
>> > >>  with EoUser a bean with two members variables:
>> > >>    eoUserId and Set<EoUserAddress> and appropriate getter and
>> setter,
>> > >>    with EoUserAddress a bean with member variables addressType and
>> name
>> > >>
>> > >> Is this possible? Right now I receive a lot of
>> > >> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
>> > >> [setParameters]: Unexpected Exception caught setting
>> > >> 'eoActivities[0].eoUser[0].eoUserId' on 'class
>> > >> com.datamat.care.actions.EoActivitiesAction: Error setting
>> expression
>> > >> 'eoActivities[0].eoUser[0].eoUserId' with value
>> > >> '[Ljava.lang.String;@1aa4bb4'
>> > >>  errors ;-(
>> > >> Thanks in advance!
>> > >>
>> > >> Joris
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >>
>> >
>>
>> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
>> > >> Sent from the Struts - User mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >>
>> ---------------------------------------------------------------------
>> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > >> For additional commands, e-mail: user-help@struts.apache.org
>> > >>
>> > >>
>> > >
>> > >
>> > > --
>> > > Rick
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> >
>>
>> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695838.html
>> > Sent from the Struts - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Rick
> 
> 

-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14727854.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by Rick Reumann <ri...@gmail.com>.
Yup Maps will work also.

On Jan 8, 2008 1:57 PM, Dave Newton <ne...@yahoo.com> wrote:

> I've never used Sets, only Maps, which definitely work...
>
> As a sanity check perhaps you could try using a Map. I know you can get a
> Set
> view of a Map, so perhaps this is an alternative solution (I'm not so sure
> about going the other direction, however).
>
> This would at least narrow down the problem to see if it's a Set v. Map
> issue.
>
> d.
>
> --- jvleminc <jo...@advalvas.be> wrote:
>
> >
> > I know. Unfortunately i can't change my business beans anymore :-(
> Anyway,
> > any other ideas? I am trying now with a
> EoActivities-conversion.properties
> > file, containing
> >
> > Element_eoActivity = com.datamat.care.bean.EoActivity
> > Element_eoUser = com.datamat.care.bean.EoUser
> > Element_eoUserAddress = com.datamat.care.bean.EoUserAddress
> >
> >
> > but no avail yet...thanks anyway!
> >
> >
> >
> > rickcr wrote:
> > >
> > > At least in Struts1.1, If I'm not mistaken, you aren't going to be
> able
> > to
> > > use indexed properties like you are to set items in a Set. If you use
> > > Lists
> > > it would be much easier to accomplish the nested collection
> population.
> > >
> > > On Jan 8, 2008 1:02 PM, jvleminc <
> joris.vleminckx.advalvas1@advalvas.be>
> > > wrote:
> > >
> > >>
> > >> Hello,
> > >>
> > >> I am facing with automatic type conversion upon the submit of my
> Form:
> > >>
> > >> Basically I have form fields with the names
> > >> eoActivities[0].activityName
> > >> eoActivities[0].eoUser[0].eoUserId
> > >> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
> > >> eoActivities[0].eoUser[0].eoUserAddress[0].name
> > >> ...
> > >> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
> > >> eoActivities[0].eoUser[0].eoUserAddress[1].name
> > >> ...
> > >> eoActivities[0].eoUser[1].eoUserId
> > >> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
> > >> eoActivities[0].eoUser[1].eoUserAddress[0].name
> > >> ...
> > >> eoActivities[1].activityName
> > >> eoActivities[1].eoUser[0].eoUserId
> > >> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
> > >> eoActivities[1].eoUser[0].eoUserAddress[0].name
> > >> ...
> > >> and so on
> > >>
> > >> I would like that the values of these form elements are automatically
> > >> inserted into the following object:
> > >> Set<EoActivity>
> > >> with EoActivity a bean with two members variables:
> > >>  activityName and Set<EoUser> and appropriate getter and setter,
> > >>  with EoUser a bean with two members variables:
> > >>    eoUserId and Set<EoUserAddress> and appropriate getter and setter,
> > >>    with EoUserAddress a bean with member variables addressType and
> name
> > >>
> > >> Is this possible? Right now I receive a lot of
> > >> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
> > >> [setParameters]: Unexpected Exception caught setting
> > >> 'eoActivities[0].eoUser[0].eoUserId' on 'class
> > >> com.datamat.care.actions.EoActivitiesAction: Error setting expression
> > >> 'eoActivities[0].eoUser[0].eoUserId' with value
> > >> '[Ljava.lang.String;@1aa4bb4'
> > >>  errors ;-(
> > >> Thanks in advance!
> > >>
> > >> Joris
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
>
> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
> > >> Sent from the Struts - User mailing list archive at Nabble.com.
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail: user-help@struts.apache.org
> > >>
> > >>
> > >
> > >
> > > --
> > > Rick
> > >
> > >
> >
> > --
> > View this message in context:
> >
>
> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695838.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Rick

Re: Type conversion with Generics

Posted by Dave Newton <ne...@yahoo.com>.
--- jvleminc <jo...@advalvas.be> wrote:
> Just noticed that this partial solution only started working after I had
> changed the Set of EoActivities into a List of EoActivities; this while the
> internal ones are still Sets. Seems the *-conversion.properties for only
> works for Lists...

That was why I suggested changing your Sets to Maps to eliminate the
collection type as a possible issue :)

d.


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


Re: Type conversion with Generics

Posted by jvleminc <jo...@advalvas.be>.
Just noticed that this partial solution only started working after I had
changed the Set of EoActivities into a List of EoActivities; this while the
internal ones are still Sets. Seems the *-conversion.properties for only
works for Lists...


jvleminc wrote:
> 
> I have already found out that by using an
> EoActivities-conversion.properties file
> I manage to get the first level mapped, ie. the line Element_eoActivity =
> com.datamatcare.bean.EoActivity works as expected and in the end a Set of
> EoActivities is created with the field activityName set correctly, but the
> inner Set<EoUser> remains null ;-(
> 
> BTW, I am also not entirely sure that by just using Lists or Maps also the
> second level elements will be mapped, those would also need some kind of
> conversion indicator (ie. *-conversion.properties file), or am I wrong?
> 
> 

-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14711210.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by jvleminc <jo...@advalvas.be>.
Btw, Martin Gainty wrote me this by email:

Rick's suggestions are very helpful..

2 things would need to know
1)How will the data be represented visually.. starting with a working
example you can use Checkbox as illustrated
http://struts.apache.org/2.x/docs/checkbox-interceptor.html

public class ActivityInterceptor extends interceptor
{
    public String intercept(ActionInvocation ai) throws Exception
   {
        Map parameters = ai.getInvocationContext().getParameters();
        Map<String, String> newParams = new HashMap<String, String>();
        Set<String> keys = parameters.keySet();
        for (Iterator<String> iterator = keys.iterator();
iterator.hasNext();)
       {
            String key = iterator.next();
            if (key.startsWith("__checkbox_"))
            {
                String name = key.substring("__checkbox_".length());
                .....
           }
        } //end for loop
    } //end intercept
}; //end class ActivityInterceptor

2)You would also need to know the datatype of the entity you are
representing..for simplicity sake I would start with 'String'
and then graduate up to your Bean EoActivity class


This means I should add my own interceptor in the stack and fill up the
beans myself, this would without doubt work, but I want to have it done
automatically by Struts2, if possible: hopefully just by adding the right
lines into the *-conversion.properties file I'd get the requested
result...the quest continues :-)
-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14701513.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by jvleminc <jo...@advalvas.be>.
Thanks for all answers so far.

I know I can wrap them in other, simpler objects; but before doing so (and
having to retouch my Javascript layer that lies on top of it :-( ), I wanted
to find out if there is a way to have Struts2 do this automatically for
me...

I have already found out that by using an EoActivities-conversion.properties
file
I manage to get the first level mapped, ie. the line Element_eoActivity =
com.datamatcare.bean.EoActivity works as expected and in the end a Set of
EoActivities is created with the field activityName set correctly, but the
inner Set<EoUser> remains null ;-(

BTW, I am also not entirely sure that by just using Lists or Maps also the
second level elements will be mapped, those would also need some kind of
conversion indicator (ie. *-conversion.properties file), or am I wrong?




-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14701510.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by Rick Reumann <ri...@gmail.com>.
I'm assuming you can't change them because someone else created them? There
are still ways you can deal with the beans with sets..
1) Wrap them using the Adapter pattern. However if they are already coming
back nested and you can used the adapters/wrappers in the business layer you
could also..
2) Push them through a conversion utility in the service layer that adds
them to your wrappers/adapters and then use those objects with Lists...

ActivityWrapper {
    EoActivity eoActivity;
    getName() { return eoActivity.getName() }
    List getUsers() { return new ArrayList( eoActivity.getUsersSet() }
    List setUsers(List list) { Set set = new Set();
         set.addAll( list );
         eoActivity.setUsersSet( set );
   }

ActivityUser
  //same thing like above

Unfortunately you're also going to want to use Session scope for the Action
form that holds your "List activittyWrappers" property. You can do it
without using Session scope, but you then add some extra complexity based
off some limitations in Struts1.1. If Request scope is a must, it can be
done though.


On Jan 8, 2008 1:30 PM, jvleminc <jo...@advalvas.be>
wrote:

>
> I know. Unfortunately i can't change my business beans anymore :-( Anyway,
> any other ideas? I am trying now with a EoActivities-conversion.properties
> file, containing
>
> Element_eoActivity = com.datamat.care.bean.EoActivity
> Element_eoUser = com.datamat.care.bean.EoUser
> Element_eoUserAddress = com.datamat.care.bean.EoUserAddress
>
>
> but no avail yet...thanks anyway!
>
>
>
> rickcr wrote:
> >
> > At least in Struts1.1, If I'm not mistaken, you aren't going to be able
> to
> > use indexed properties like you are to set items in a Set. If you use
> > Lists
> > it would be much easier to accomplish the nested collection population.
> >
> > On Jan 8, 2008 1:02 PM, jvleminc <jo...@advalvas.be>
> > wrote:
> >
> >>
> >> Hello,
> >>
> >> I am facing with automatic type conversion upon the submit of my Form:
> >>
> >> Basically I have form fields with the names
> >> eoActivities[0].activityName
> >> eoActivities[0].eoUser[0].eoUserId
> >> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
> >> eoActivities[0].eoUser[0].eoUserAddress[0].name
> >> ...
> >> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
> >> eoActivities[0].eoUser[0].eoUserAddress[1].name
> >> ...
> >> eoActivities[0].eoUser[1].eoUserId
> >> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
> >> eoActivities[0].eoUser[1].eoUserAddress[0].name
> >> ...
> >> eoActivities[1].activityName
> >> eoActivities[1].eoUser[0].eoUserId
> >> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
> >> eoActivities[1].eoUser[0].eoUserAddress[0].name
> >> ...
> >> and so on
> >>
> >> I would like that the values of these form elements are automatically
> >> inserted into the following object:
> >> Set<EoActivity>
> >> with EoActivity a bean with two members variables:
> >>  activityName and Set<EoUser> and appropriate getter and setter,
> >>  with EoUser a bean with two members variables:
> >>    eoUserId and Set<EoUserAddress> and appropriate getter and setter,
> >>    with EoUserAddress a bean with member variables addressType and name
> >>
> >> Is this possible? Right now I receive a lot of
> >> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
> >> [setParameters]: Unexpected Exception caught setting
> >> 'eoActivities[0].eoUser[0].eoUserId' on 'class
> >> com.datamat.care.actions.EoActivitiesAction: Error setting expression
> >> 'eoActivities[0].eoUser[0].eoUserId' with value
> >> '[Ljava.lang.String;@1aa4bb4'
> >>  errors ;-(
> >> Thanks in advance!
> >>
> >> Joris
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > Rick
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695838.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Rick

Re: Type conversion with Generics

Posted by Dave Newton <ne...@yahoo.com>.
I've never used Sets, only Maps, which definitely work...

As a sanity check perhaps you could try using a Map. I know you can get a Set
view of a Map, so perhaps this is an alternative solution (I'm not so sure
about going the other direction, however).

This would at least narrow down the problem to see if it's a Set v. Map
issue.

d.

--- jvleminc <jo...@advalvas.be> wrote:

> 
> I know. Unfortunately i can't change my business beans anymore :-( Anyway,
> any other ideas? I am trying now with a EoActivities-conversion.properties
> file, containing
> 
> Element_eoActivity = com.datamat.care.bean.EoActivity
> Element_eoUser = com.datamat.care.bean.EoUser
> Element_eoUserAddress = com.datamat.care.bean.EoUserAddress
> 
> 
> but no avail yet...thanks anyway!
> 
> 
> 
> rickcr wrote:
> > 
> > At least in Struts1.1, If I'm not mistaken, you aren't going to be able
> to
> > use indexed properties like you are to set items in a Set. If you use
> > Lists
> > it would be much easier to accomplish the nested collection population.
> > 
> > On Jan 8, 2008 1:02 PM, jvleminc <jo...@advalvas.be>
> > wrote:
> > 
> >>
> >> Hello,
> >>
> >> I am facing with automatic type conversion upon the submit of my Form:
> >>
> >> Basically I have form fields with the names
> >> eoActivities[0].activityName
> >> eoActivities[0].eoUser[0].eoUserId
> >> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
> >> eoActivities[0].eoUser[0].eoUserAddress[0].name
> >> ...
> >> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
> >> eoActivities[0].eoUser[0].eoUserAddress[1].name
> >> ...
> >> eoActivities[0].eoUser[1].eoUserId
> >> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
> >> eoActivities[0].eoUser[1].eoUserAddress[0].name
> >> ...
> >> eoActivities[1].activityName
> >> eoActivities[1].eoUser[0].eoUserId
> >> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
> >> eoActivities[1].eoUser[0].eoUserAddress[0].name
> >> ...
> >> and so on
> >>
> >> I would like that the values of these form elements are automatically
> >> inserted into the following object:
> >> Set<EoActivity>
> >> with EoActivity a bean with two members variables:
> >>  activityName and Set<EoUser> and appropriate getter and setter,
> >>  with EoUser a bean with two members variables:
> >>    eoUserId and Set<EoUserAddress> and appropriate getter and setter,
> >>    with EoUserAddress a bean with member variables addressType and name
> >>
> >> Is this possible? Right now I receive a lot of
> >> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
> >> [setParameters]: Unexpected Exception caught setting
> >> 'eoActivities[0].eoUser[0].eoUserId' on 'class
> >> com.datamat.care.actions.EoActivitiesAction: Error setting expression
> >> 'eoActivities[0].eoUser[0].eoUserId' with value
> >> '[Ljava.lang.String;@1aa4bb4'
> >>  errors ;-(
> >> Thanks in advance!
> >>
> >> Joris
> >>
> >> --
> >> View this message in context:
> >>
>
http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> > 
> > 
> > -- 
> > Rick
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695838.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


Re: Type conversion with Generics

Posted by jvleminc <jo...@advalvas.be>.
I know. Unfortunately i can't change my business beans anymore :-( Anyway,
any other ideas? I am trying now with a EoActivities-conversion.properties
file, containing

Element_eoActivity = com.datamat.care.bean.EoActivity
Element_eoUser = com.datamat.care.bean.EoUser
Element_eoUserAddress = com.datamat.care.bean.EoUserAddress


but no avail yet...thanks anyway!



rickcr wrote:
> 
> At least in Struts1.1, If I'm not mistaken, you aren't going to be able to
> use indexed properties like you are to set items in a Set. If you use
> Lists
> it would be much easier to accomplish the nested collection population.
> 
> On Jan 8, 2008 1:02 PM, jvleminc <jo...@advalvas.be>
> wrote:
> 
>>
>> Hello,
>>
>> I am facing with automatic type conversion upon the submit of my Form:
>>
>> Basically I have form fields with the names
>> eoActivities[0].activityName
>> eoActivities[0].eoUser[0].eoUserId
>> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
>> eoActivities[0].eoUser[0].eoUserAddress[0].name
>> ...
>> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
>> eoActivities[0].eoUser[0].eoUserAddress[1].name
>> ...
>> eoActivities[0].eoUser[1].eoUserId
>> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
>> eoActivities[0].eoUser[1].eoUserAddress[0].name
>> ...
>> eoActivities[1].activityName
>> eoActivities[1].eoUser[0].eoUserId
>> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
>> eoActivities[1].eoUser[0].eoUserAddress[0].name
>> ...
>> and so on
>>
>> I would like that the values of these form elements are automatically
>> inserted into the following object:
>> Set<EoActivity>
>> with EoActivity a bean with two members variables:
>>  activityName and Set<EoUser> and appropriate getter and setter,
>>  with EoUser a bean with two members variables:
>>    eoUserId and Set<EoUserAddress> and appropriate getter and setter,
>>    with EoUserAddress a bean with member variables addressType and name
>>
>> Is this possible? Right now I receive a lot of
>> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
>> [setParameters]: Unexpected Exception caught setting
>> 'eoActivities[0].eoUser[0].eoUserId' on 'class
>> com.datamat.care.actions.EoActivitiesAction: Error setting expression
>> 'eoActivities[0].eoUser[0].eoUserId' with value
>> '[Ljava.lang.String;@1aa4bb4'
>>  errors ;-(
>> Thanks in advance!
>>
>> Joris
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Rick
> 
> 

-- 
View this message in context: http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695838.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Type conversion with Generics

Posted by Rick Reumann <ri...@gmail.com>.
At least in Struts1.1, If I'm not mistaken, you aren't going to be able to
use indexed properties like you are to set items in a Set. If you use Lists
it would be much easier to accomplish the nested collection population.

On Jan 8, 2008 1:02 PM, jvleminc <jo...@advalvas.be>
wrote:

>
> Hello,
>
> I am facing with automatic type conversion upon the submit of my Form:
>
> Basically I have form fields with the names
> eoActivities[0].activityName
> eoActivities[0].eoUser[0].eoUserId
> eoActivities[0].eoUser[0].eoUserAddress[0].addressType
> eoActivities[0].eoUser[0].eoUserAddress[0].name
> ...
> eoActivities[0].eoUser[0].eoUserAddress[1].addressType
> eoActivities[0].eoUser[0].eoUserAddress[1].name
> ...
> eoActivities[0].eoUser[1].eoUserId
> eoActivities[0].eoUser[1].eoUserAddress[0].addressType
> eoActivities[0].eoUser[1].eoUserAddress[0].name
> ...
> eoActivities[1].activityName
> eoActivities[1].eoUser[0].eoUserId
> eoActivities[1].eoUser[0].eoUserAddress[0].addressType
> eoActivities[1].eoUser[0].eoUserAddress[0].name
> ...
> and so on
>
> I would like that the values of these form elements are automatically
> inserted into the following object:
> Set<EoActivity>
> with EoActivity a bean with two members variables:
>  activityName and Set<EoUser> and appropriate getter and setter,
>  with EoUser a bean with two members variables:
>    eoUserId and Set<EoUserAddress> and appropriate getter and setter,
>    with EoUserAddress a bean with member variables addressType and name
>
> Is this possible? Right now I receive a lot of
> 17:52:32 ERROR [ParametersInterceptor:204] ParametersInterceptor -
> [setParameters]: Unexpected Exception caught setting
> 'eoActivities[0].eoUser[0].eoUserId' on 'class
> com.datamat.care.actions.EoActivitiesAction: Error setting expression
> 'eoActivities[0].eoUser[0].eoUserId' with value
> '[Ljava.lang.String;@1aa4bb4'
>  errors ;-(
> Thanks in advance!
>
> Joris
>
> --
> View this message in context:
> http://www.nabble.com/Type-conversion-with-Generics-tp14695286p14695286.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Rick