1

我正在使用 hashmap 并将其设置在 session.in s:select 标记中。

<s:select name="language" id="language" headerKey="-1"   headerValue="All Languages" cssStyle="width:210px" list="#session.languages"  />

在jsp中访问地图时有时会出现以下错误,

org.apache.jasper.JasperException: org.apache.jasper.JasperException: tag 'select', field 'list', name 'language': The requested list key '#session.languages' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

请就问题提出建议。

4

1 回答 1

0

struts2 无法识别您的对象类型,您应该这样做。

<s:select name="language" list="#session.languages" listKey="id" listValue="name" />
于 2012-07-12T10:22:12.963 回答