Re: Type conversion collection with interface type elements

2018-04-05 Thread Yasser Zamani
On 4/4/2018 7:20 PM, Nuno Oliveira wrote: > Hi, > > I am having problems populating an action variable Set by request using > struts type conversion if the Set has the element type defined as an > interface. > I have a UserAction-conversion.properties file with the following > configuration usin

Re: Type conversion on a Map

2012-09-24 Thread Lukasz Lenart
2012/9/21 Miguel Almeida : > Sure! > > Here's a maven project with a failing test case. > > There's actually a map being built, but it's a , and the key > reads "OGNL no conversion possible". Got it working, but I think the main problem is with key value - it isn't a simple string but an int that

RE: Type conversion on a Map

2012-09-21 Thread Miguel Almeida
On Fri, 2012-09-21 at 09:04 -0400, Martin Gainty wrote: > a stupid question but i have to ask If you mean "where is the initialisation of simpleMap e.g. simpleMap=new java.util.HashMap();" - it's not there. I don't think you need to, Struts initializes it. (see below) > > public class TypeConve

RE: Type conversion on a Map

2012-09-21 Thread Martin Gainty
ets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: Re: Type conversion on a Map From: mig...@almeida.at To: user@struts.apache.org Date: Fri, 21 Sep 2012 10:31:24 +0100 Sure! Here's a maven project with a failing test case.

Re: Type conversion on a Map

2012-09-20 Thread Lukasz Lenart
Hi, Could you share the unit test as well ? The whole code would be the best :-) Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands

Re: Type conversion of List - how does one do it?

2011-05-18 Thread Miguel
On Tue, 2011-05-17 at 14:42 -0700, Jeffrey Black wrote: > Hey there Miguel. > > Have a look here: > > http://struts.apache.org/2.0.14/docs/type-conversion.html#TypeConversion-GenericsandErasure Thanks Jb. In my case a possible solution is to remove the generic reference to the list (ie, ch

Re: Type conversion of List - how does one do it?

2011-05-17 Thread Jeffrey Black
Hey there Miguel.   Have a look here:   http://struts.apache.org/2.0.14/docs/type-conversion.html#TypeConversion-GenericsandErasure   Best,   jb From: Miguel To: user@struts.apache.org Sent: Tuesday, May 17, 2011 5:19 AM Subject: Type conversion of List - how does one do it? I've always struggle

Re: Type Conversion and Lists

2009-09-25 Thread Dave Newton
Stephen Turner wrote: Hello, I'm trying to get objects placed in a List using the type conversion functionality built into Struts 2 (2.0.14)/Java 1.4. The bean that should be in the list is called "Grocery", with attributes "name" and "quantity". My action class has a List called "groceries".

Re: Type conversion exceptions

2009-03-20 Thread musomesa
No problem -- I have learnt plenty from others too. Cheers Chris M. -Original Message- From: ryangr To: user@struts.apache.org Sent: Fri, 20 Mar 2009 5:12 am Subject: Re: Type conversion exceptions Well I'll be damned...it's working! It looks like the solution was to

Re: Type conversion exceptions

2009-03-19 Thread ryangr
?? > ??? > name='settings[].title' > ????value='' type="hidden" /> > > '> > : > ??? > ??? > name='settings[].value' > value='' /> > ?? > ? > ? > ? > ? > ?

Re: Type conversion exceptions

2009-03-18 Thread musomesa
s.newSetting = newSetting; ?}; } JSP: ? ?? ??? '> : ??? ??? ?? ? ? ? ? ? Cheers Chris M -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 10:55 pm Subject: Re: Type conversion exceptions Here is the converter code: http://pastie.org/41970

Re: Type conversion exceptions

2009-03-18 Thread ryangr
Here is the converter code: http://pastie.org/419709 Obviously it isn't doing anything other than outputting the values being passed in, but none of the values contain anything yet as the parameters are getting lost somewhere so there's no point in processing them yet. musomesa wrote: > > I h

Re: Type conversion exceptions

2009-03-18 Thread musomesa
10 pm Subject: Re: Type conversion exceptions 2009/3/18 : > But then how do you plan to write a converter to convert a String[] to a SettingList? It's already done, just to the configuration has to be adjusted > Also why is aggregation a bad design? It isn't but exposing di

Re: Type conversion exceptions

2009-03-18 Thread Lukasz Lenart
2009/3/18 : > But then how do you plan to write a converter to convert a String[] to a > SettingList? It's already done, just to the configuration has to be adjusted > Also why is aggregation a bad design? It isn't but exposing directly internal field (ArrayList) it is. Regards -- Lukasz ht

Re: Type conversion exceptions

2009-03-18 Thread musomesa
But then how do you plan to write a converter to convert a String[] to a SettingList? Also why is aggregation a bad design? Regards Chris M -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 18 Mar 2009 5:50 pm Subject: Re: Type conversion exceptions

Re: Type conversion exceptions

2009-03-18 Thread Lukasz Lenart
2009/3/18 : > My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it > aggregation so that SettingList has a property of type ArrayList and > your type conversion problems will go away. In such case SettingList is useless, it will be bad design Regards -- Lukasz http:/

Re: Type conversion exceptions

2009-03-18 Thread musomesa
2009 6:59 am Subject: Re: Type conversion exceptions Okay, I'm officially very confused as to what should and shouldn't be used since apparently the documentation example is not correct. Let me level set with what each of my files contains again: [xwork-conversion.properties] E

Re: Type conversion exceptions

2009-03-18 Thread Lukasz Lenart
2009/3/17 ryangr : > [xwork-conversion.properties] > Element_settings=com.rjssoft.webdocs.setting.Setting That's ok but your SettingList is not full List implementation and you have to specified how to convert array to SettingList that's why you have to specified also converter for SettingList abo

Re: Type conversion exceptions

2009-03-18 Thread musomesa
rs Chris M? > >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 6:59 am Subject: Re: Type conversion exceptions Okay, I'm officially very confused as to what s

Re: Type conversion exceptions

2009-03-17 Thread ryangr
Okay, I'm officially very confused as to what should and shouldn't be used since apparently the documentation example is not correct. Let me level set with what each of my files contains again: [xwork-conversion.properties] Element_settings=com.rjssoft.webdocs.setting.Setting According to the d

Re: Type conversion exceptions

2009-03-17 Thread Lukasz Lenart
2009/3/17 ryangr : > com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting What this is for? > com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter This tells Xwork which converter to call if it will need to convert Array to SettingList

Re: Type conversion exceptions

2009-03-17 Thread ryangr
If I do that, then there will be two lines as such in the properties file: com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter How will it know the difference? I followed the docume

Re: Type conversion exceptions

2009-03-17 Thread Lukasz Lenart
2009/3/17 ryangr : > Element_settings=com.rjssoft.webdocs.setting.Setting But you should put there com.rjssoft.webdocs.setting.SettingList = com.rjssoft.webdocs.setting.Setting Regards -- Lukasz http://www.lenart.org.pl/ - To

Re: Type conversion exceptions

2009-03-17 Thread ryangr
I do have the global xwork-conversion.properties in the proper WEB-INF/classes which is loaded above the section of the log that I copied along with the SettingAction-conversion.properties in the SettingAction class directory. The Setting-Action-conversion.properties only contains: Element_settin

Re: Type conversion exceptions

2009-03-17 Thread Lukasz Lenart
2009/3/16 ryangr : > com.opensymphony.xwork2.util.XWorkConverter  - processing conversion file > [com/rjssoft/webdocs/admin/SettingAction-conversion.properties] [class=class > com.rjssoft.webdocs.admin.SettingAction] As I see you have only SettingAction-conversion.properties, could you try to use

Re: Type conversion exceptions

2009-03-16 Thread ryangr
Somewhere in here it appears to be losing the values because the parameter interceptor has them then once it hits the converter they disappear: com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting params settings[0].value => [ 192.168.1.1 ] settings[0].title => [ SMTP Server Addre

Re: Type conversion exceptions

2009-03-16 Thread ryangr
Yes. Hence why I'm confused! :confused: :-D Ryan Lukasz Lenart wrote: > > 2009/3/16 ryangr : >> >> Yes, I have it listed in the xwork-conversion.properties file as such: >> >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > > And the file is in t

Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr : > > Yes, I have it listed in the xwork-conversion.properties file as such: > > com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter And the file is in the root of your classpath (WEB-INF/classes)? Regards -- Lukasz http://www.lenart.org.p

Re: Type conversion exceptions

2009-03-16 Thread ryangr
Yes, I have it listed in the xwork-conversion.properties file as such: com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter Ryan Lukasz Lenart wrote: > > > It's strange but anyway you should be able to use Struts2 / XWork2 > convertion mechanism, did yo

Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr : > It appears both values objects (value and o, respectively) are completely > empty... It's strange but anyway you should be able to use Struts2 / XWork2 convertion mechanism, did you setup xwork-conversion.properties file as mentioned in documentation [1]? [1] http://struts.a

Re: Type conversion exceptions

2009-03-16 Thread ryangr
Well I can't seem to find documentation or examples of how to use the convertValue() API. This is what each call outputs (it seems both versions get called each time the converter is run): Called convertValue(Map, Object, Member, String, Object, Class) target: com.rjssoft.webdocs.admin.settingact

Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr : > That makes sense...I've added a converter for it similar to others that > already exist in the app, but it doesn't appear to be calling > convertFromString which the others use. Instead, it seems to be calling > convertValue(Map, Object, Member, String, Object, Class) which I d

Re: Type conversion exceptions

2009-03-16 Thread ryangr
That makes sense...I've added a converter for it similar to others that already exist in the app, but it doesn't appear to be calling convertFromString which the others use. Instead, it seems to be calling convertValue(Map, Object, Member, String, Object, Class) which I do not see in the Struts 2.

Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr : > settings is a SettingList which is just an extended ArrayList. That can be a problem, generics are erased during compilation and Ognl doesn't know how to convert array to SettingList, did you try to prepare converter for it? Regards -- Lukasz http://www.lenart.org.pl/

Re: Type conversion exceptions

2009-03-16 Thread ryangr
settings is a SettingList which is just an extended ArrayList. The rendered source looks like: Currently there is only one Setting, but adding another arbitrary entry does come up with settings[1].value, etc. Ryan Lukasz Lenart wrote: > > 2009/3/16 ryangr : >> ERROR com.opensymphony.xwork2.

Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr : > ERROR com.opensymphony.xwork2.util.InstantiatingNullHandler  - Could not > create and/or set value back on to object > ognl.OgnlException: settings [java.lang.IllegalArgumentException: argument > type mismatch] > ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor  

Re: Type conversion exceptions

2009-03-16 Thread ryangr
Okay, I changed it back to settings[0] type syntax (I had tried it before and it didn't work), so now I have this:

Re: Type conversion exceptions

2009-03-14 Thread dusty
your syntax for the field name should be ...name = "settings[]" rather than name = "settings()" Also, I think your action expects to build a List of Settings rather than Map of settings. If that is the case then you don't want to use key values in settings[ASDF1-123AS-123SA-123] you want to us

Re: Type conversion errors for collections

2009-01-26 Thread Owen Berry
Accidentally found out how to do this: invalid.fieldvalue.deliveryLocations[*].port=Delivery Location Port is invalid Posting it for others who may have the same question. On Mon, Jan 26, 2009 at 1:37 PM, Owen Berry wrote: > I have an action that has a collection of objects. Conversion to and

Re: Type conversion?

2009-01-19 Thread dusty
So, when you write you are asking Struts to convert your list to a string and represent it like: and I am not sure that is what you want. Because when you resubmit that String struts is not really sure how to rebuild the list. I see you have read up on type conversion and that is good. The

Re: type conversion per method

2008-08-22 Thread Jason Deffenbaugh
Figured it out. Had a bad URL going. Thanks! On Fri, 2008-08-22 at 14:41 -0400, Jason Deffenbaugh wrote: > I'm running struts 2.0.11 trying to do a custom type conversion. > > The conversion is working for the action that calls the execute() method > in the action class but it does not work for

Re: Type conversion with enum elements

2008-04-15 Thread Ralf Fischer
Hi On Tue, Apr 15, 2008 at 12:29 PM, Ramanathan RV <[EMAIL PROTECTED]> wrote: > Hello, > > I wish to display/read value that belongs to an enumerated type. Struts > seems to handle Class and Enum differently. For instance, > > *xwork-conversion* > > com.company.utils.Constants.EducationalQual

Re: Type conversion with enum elements

2008-04-15 Thread Giovanni Azua
hi, A simple workaround would be defining the bean property as String type rather than as the actual enum. Then use the two enum type built in operations "name()" and "valueOf()" to implement the getter and setter respectively. If there is actually an elegant way to do it, I would also be i

Re: Type conversion questions

2008-02-20 Thread Jeromy Evans
Now the funny thing is that this seems to work. I got all sorts of exceptions at first, but they don't seem to be related to conversion. Thanks for all your help, and I'm sorry for wasting your time on this one. I'll get back when I find the real problem, should it be related to struts. Da

Re: Type conversion questions

2008-02-20 Thread Daniel Baldes
Laurie Harper wrote: Daniel Baldes wrote: [...] [...] This way I could use getMyObjects() for displaying my objects and setMyObjects() for setting them (using only their IDs). Doesn't this imply that the myObjects property represents both the set of values that can be selected *and* t

Re: Type conversion questions

2008-02-20 Thread Daniel Baldes
Hi Jeromy, Jeromy Evans wrote: Ah, I see the problem better now. In your select: you're trying to access myObjects as both a list of objects (list=) and as a string (name=). You can't do what you're describing because convertToString needs to provide the currently selected value for the s

Re: Type conversion questions

2008-02-20 Thread Laurie Harper
Daniel Baldes wrote: [...] 1. extending StrutsTypeConverter forces me to implement String convertToString(Map context, Object o). I think there is no common sense way of converting a collection back to a String in this context. It would, maybe, make sense to convert it to a String[]. But what

Re: Type conversion questions

2008-02-20 Thread Jeromy Evans
Daniel Baldes wrote: the problem here is that convertToString only allows returning .. a String. Accessing "myObjects" in a JSP would always call converter.convertToString(context, myaction.getMyObjects()) (as far as I can tell). So this way I can't return a collection of objects where I co

Re: Type conversion questions

2008-02-20 Thread Daniel Baldes
Hi Jeromy, Jeromy Evans wrote: Daniel Baldes wrote: [...] 2. Is there a way to define a type converter application wide, like "always use this type converter for setting types which are subclasses of X" and "for setting types which are Collection"? This way I could define the type converter

Re: Type conversion questions

2008-02-20 Thread Daniel Baldes
Jeromy Evans wrote: [...] Now my questions: 1. extending StrutsTypeConverter forces me to implement String convertToString(Map context, Object o). I think there is no common sense way of converting a collection back to a String in this context. It would, maybe, make sense to convert it to a S

Re: Type conversion questions

2008-02-20 Thread Daniel Baldes
Hello Martin, this would be ok, but that method doesn't exist in StrutsTypeConverter as of struts 2.0.11, and most likely the framework won't call it when I implement it. Or am I missing something? Daniel Martin Gainty wrote: package org.apache.struts2.showcase.conversion public class EnumT

Re: Type conversion questions

2008-02-19 Thread Jeromy Evans
Hi Jeromy I'm not clear what the performance problem you mention could be. This is what I'm doing myself and while my app's performance is OK, I would love to improve it. What do you mean by (e.g. select n+1 due to iteration)? All the best Adam --- Actually, I've assumed you're using ORM

Re: Type conversion questions

2008-02-19 Thread Adam Hardy
Jeromy Evans on 19/02/08 22:23, wrote: Daniel Baldes wrote: Hello, I have a web form where you can, generally speaking, assign objects to groups. This is done via a multiple select box which displays an object's name and uses its ID property as value. So, usually, my action would get back a

Re: Type conversion questions

2008-02-19 Thread Martin Gainty
TECTED]> To: "Struts Users Mailing List" Sent: Tuesday, February 19, 2008 5:23 PM Subject: Re: Type conversion questions > Daniel Baldes wrote: > > Hello, > > > > I have a web form where you can, generally speaking, assign objects to > > groups. This is d

Re: Type conversion questions

2008-02-19 Thread Jeromy Evans
Daniel Baldes wrote: Hello, I have a web form where you can, generally speaking, assign objects to groups. This is done via a multiple select box which displays an object's name and uses its ID property as value. So, usually, my action would get back a String array containing the IDs of the

Re: Type conversion with Generics

2008-01-09 Thread ravi_eze
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 r

Re: Type conversion with Generics

2008-01-09 Thread Dave Newton
--- jvleminc <[EMAIL PROTECTED]> 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

Re: Type conversion with Generics

2008-01-09 Thread jvleminc
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 u

Re: Type conversion with Generics

2008-01-08 Thread jvleminc
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

Re: Type conversion with Generics

2008-01-08 Thread jvleminc
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 us

Re: Type conversion with Generics

2008-01-08 Thread Rick Reumann
Yup Maps will work also. On Jan 8, 2008 1:57 PM, Dave Newton <[EMAIL PROTECTED]> 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

Re: Type conversion with Generics

2008-01-08 Thread Dave Newton
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

Re: Type conversion with Generics

2008-01-08 Thread Rick Reumann
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)

Re: Type conversion with Generics

2008-01-08 Thread jvleminc
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.da

Re: Type conversion with Generics

2008-01-08 Thread Rick Reumann
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 <[EMAIL PROTECTED]> wrote: > > Hello, > >

Re: Type Conversion

2007-06-15 Thread Dave Newton
--- Mansour <[EMAIL PROTECTED]> wrote: > I am trying to convert a string into an Object. I > can not find documentation on how to implement the > StrutsTypeConverter. The documentation says: > > To create a type converter one would need to extends > StrutsTypeConverter. > > public class MyConvert

Re: Type-Conversion error - NPE

2007-04-11 Thread Felipe Rodrigues
Did you really think I made it because I want to? Tim Williams wrote: > > On 4/9/07, Felipe Rodrigues <[EMAIL PROTECTED]> wrote: >> >> Hi Guys, >> I'm trying to use the Type Conversion at Struts2, but I'm getting a NPE. >> >> Here is my MyAction-conversion.properties file: >> >> KeyProperty_ins

Re: Type-Conversion error - NPE

2007-04-09 Thread Tim Williams
On 4/9/07, Felipe Rodrigues <[EMAIL PROTECTED]> wrote: Hi Guys, I'm trying to use the Type Conversion at Struts2, but I'm getting a NPE. Here is my MyAction-conversion.properties file: KeyProperty_insertList=id Element_insertList=my.package.MyBean CreateIfNull_insertList=true MyAction has the

Re: Type Conversion Messages i18n

2007-01-24 Thread Tom Schneider
I'm assuming this is for Struts 2. If not, please ignore me. :) This is one thing I wish they would improve in Struts 2--it's certainly not as obvious or trivial as I would expect it, but this little tidbit was buried deep in the book: 'Webwork in Action'. Here is an example of one of our me