Using ww:select to set non-trivial properties
Matt Hargus <[email protected]> Wed, 27 Dec 2006 16:18:56 CST
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <27305162.1167258077776.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
I've searched around the forum and haven't seen a good answer to this question, so here it goes.
Here's my setup. I have two classes, one existing as the property of the other:
public class Person {
private String name;
private Car favoriteCar;
....getters/setters/etc
}
public class Car {
private int id;
private String make;
private String model;
private int year;
...getters/setters/etc
}
When creating a new Person, I would like to be able to select from a drop-down of available Cars to assign to the Person's favoriteCar property. I already know how to get the list of available Cars to the ww:select tag in the jsp page, but after that I'm lost.
I get errors that indicate the action is trying to set the property to the key of the selected Car, but I want it to set the actual Car object. Is there any way to do this without resorting to a custom type converter?
Thanks in advance.
Matt[i][/i][i][/i][i][/i][i][/i][i][/i]
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=55649&messageID=110655#110655