mardi 3 mars 2015

Display Set type using JSTL

I am getting PropertyNotFoundException while trying to populate select box in JSP using JSTL in Spring WebFlow. I (think) I have all implementation correct. Can anyone point out if I missed anything.


Below is my code snippet:


JSTL in JSP



<form:select path="${field.fieldCode}">
<form:options items="${states.code}" />
</form:select>


Country and State class



Class State {
private Long id;
private Country country;
private String code;
private String name;
}

Class Country {
....
private Set<State> states;
}


Service Class



@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 config



<evaluate expression="domainGeoService.getStates()" result="viewScope.states"/>


**Exact exception I am getting **



Caused by: javax.el.PropertyNotFoundException: Property 'code' not found on type org.hibernate.collection.PersistentSet

Aucun commentaire:

Enregistrer un commentaire