0
私はstruts 2を使用していますが、strutsタグを使用したいと思います。 私は値スタックからリストを取得するためにstruts2の値スタックから値を取得できません
<s:select list="types" name="list"/>
を使用したい、ここに私のアクションコード
ValueStack valueStack = ServletActionContext.getContext().getValueStack();
valueStack.pop();
valueStack.push(types);
がある。しかし、それはwork.Hereはエラーメッセージ
HTTP Status 500 - tag 'select', field 'list', name 'list': The requested list key '#types' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
ありませんでした
しかし、リストをrequestScopeに入れると、このように動作します。<s:select list="types" name="#request.types"/>
どうすればいいですか?
あなたは、むしろ(getTypesを持っている必要があります)メソッドを使用して、値クラスを直接操作するのではなく、アクションクラスに追加する必要があります。 – Walid
ありがとうございました。私はちょうどあなたが言ったように、それは動作します –