私はJSPでこのドロップダウンがあります。取得対象:選択ドロップダウン
<s:select name = "destination"
label = "the destination"
list = "drop"
listValue = "nameDest"
headerKey = "0"
headerValue = "chose a destination" />
をしてdestination
オブジェクトはアクションクラスにあります:
private Destination destination;
//getters and setters
私が提出すると、このエラーが発生します。
No result defined for action
com.iticsys.GBO.actions.UserAction
and resultinput
ドロップダウンを削除すると、すべて正常に機能しました。だから、Strutsは、選択された値の値を、アクションクラスのdestination
オブジェクトに文字列であるnameDest
から入れようとしていると思います。
どうすれば選択したオブジェクトを取得できますか?
UPDATE:
宛先が宛先クラスからインスタンス化オブジェクトである:
@Entity
public class Destination {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idDest;
private String nameDest;
ドロップ先のリストである:(アンドレアLigiosによって示唆さ)は、いくつかの変形後
private List<Destination> drop;
public List<Destination> getDrop() {
return drop;
}
public void setDrop(List<Destination> drop) {
this.drop = drop;
}
オンドロップダウン:
<tr>
<td>
<s:select
name="destination.idDest"
label="the destination"
list="drop"
listKey="idDest"
listValue="nameDest"
headerKey="0"
headerValue="Chose a destination" />
</td>
</tr>
私はこのエラー
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}
'Destination'オブジェクトとは何ですか? – meskobalazs
アップデートをご覧ください! –