【发布时间】:2015-03-04 17:15:03
【问题描述】:
我在尝试使用 Spring MVC 在 JSP 中填充选择框时遇到 PropertyNotFoundException。我(认为)我的所有实现都是正确的。任何人都可以指出我是否遗漏了什么。
下面是我的代码sn-p:
JSP 中的 Spring MVC
<form:select path="${field.fieldCode}">
<form:options items="${states.code}" />
</form:select>
国家和州级
Class State {
private Long id;
private Country country;
private String code;
private String name;
}
Class Country {
....
private Set<State> states;
}
服务类
@Transactional(readOnly=true)
@Service("domainGeoService")
public class DomainGeoServiceImpl implements DomainGeoService {
@Override
public Set<State> getStates() {
Country usa = (Country)sessionFactory.getCurrentSession().get(Country.class, 1L);
return usa.getStates();
}
}
Webflow 配置
<evaluate expression="domainGeoService.getStates()" result="viewScope.states"/>
**我得到的确切异常**
Caused by: javax.el.PropertyNotFoundException: Property 'code' not found on type org.hibernate.collection.PersistentSet
【问题讨论】:
标签: java spring jsp spring-mvc spring-webflow