struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "red phoenix" <>
Subject struts2 <s:select> question
Date Sun, 02 Mar 2008 11:03:39 GMT
I use struts2.0.11, I use Hibernate to get data and put it into attribute in
struts2 action,like follows:
public String show() throws Exception{
  List myList=this.getHibernateTemplate().find("from test.MyModel");
  return SUCCESS;

Hibernate mapping file is follows:
 <class name="test.MyModel" table="Test">
  <id name="id" column="id" type="java.lang.String">
   <generator class="assigned"/>
  <property name="cname" type="java.lang.String">
   <column name="name" length="50" not-null="false" />

Then I want to show myList by using <s:select> tag,like follows:
<s:select label="Myname" headerKey="-1" headerValue="choose"
list="%{myList}" listKey="" listValue="MyModel.cname" />

When I run it,it raise following error:
org.apache.jasper.JasperException: tag 'select', field 'list': The requested
list key '%{myList}' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]

I have searched google for several days,but I don't find how to solve it. I
am puzzled with it! I want to know how to correct my <s:select> code?
Any idea will be appreciated!
Best regards

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message