Strut2:处理请求期间发生异常:标记'select',字段'list',名称'abc':请求的列表键'xyz'无法解析为集合/数组/映射/枚举类型。
<div class="form-group">
<label for="ABC" class="col-md-3 control-label">
ABC: </label>
<div class="col-md-9">
<s:select name="abc"
list="xyz"
id="abc" class="form-control" />
</div>
</div>
这是JSP代码
在Java类
中import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class Test extends ActionSupport implements Preparable {
private List xyz = new ArrayList<String>();
public List getXyz() {
return xyz;
}
public void setXyz(List xyz) {
this.xyz = xyz;
}
@Override
public void prepare() throws Exception {
// TODO Auto-generated method stub
Database connectivity and fetch data from DB and adding that data to
xyz
}
}
并且在java类的构造函数中,我试图从数据库中填充列表。