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

Type conversion questions

2008-02-19 Thread Daniel Baldes
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 selected objects. I w