I have this dropdown in the JSP:
<s:select name = "destination"
label = "the destination"
list = "drop"
listValue = "nameDest"
headerKey = "0"
headerValue = "chose a destination" />
and there is the destination
object in the action class:
private Destination destination;
//getters and setters
but when I submit, I get this error:
No result defined for action
com.iticsys.GBO.actions.UserAction
and resultinput
When I removed the dropdown, everything worked fine. So I think that Struts is trying to put the value of the selected value from nameDest
, which is a string, into the destination
object in the action class.
So how could I get the selected object?
UPDATE :
destination is an object instanced from Destination class :
@Entity
public class Destination {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idDest;
private String nameDest;
drop is a list of Destination :
private List<Destination> drop;
public List<Destination> getDrop() {
return drop;
}
public void setDrop(List<Destination> drop) {
this.drop = drop;
}
After some modification (suggested by Andrea Ligios ) on the drop down:
<tr>
<td>
<s:select
name="destination.idDest"
label="the destination"
list="drop"
listKey="idDest"
listValue="nameDest"
headerKey="0"
headerValue="Chose a destination" />
</td>
</tr>
I got this error
1.tag 'select', field 'list', name 'destination.idDest': The requested list key 'drop' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}