<bean id="propertyData"
class="org.springframework.beans.factory.config.PropertiesFactoryBean"
lazy-init="false">
<property name="mydata">
<value>classpath:external-data.properties</value>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
<property name="exposedContextBeanNames">
<list><value>propertyData</value></list>
</property>
</bean>
Using the snippet above , I am able to load property file and access the same in jsp. And successfully accessing value by key using the following syntax in jsp
<option value='${propertyData.usa}'>${propertyData.usa}</option>
Now I need to iterate over all the property keys in jsp using jstl or other means to populate an html dropdown with the values of those keys.
The Following is not working for me.
<core:forEach var="listVar" items="${propertyData}">
<option value ="10"><core:out value="${listVar.attribute}"/></option>
</core:forEach>
Error is:
javax.el.PropertyNotFoundException: Property 'attribute' not found on type java.util.Hashtable$Entry
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237)
Please correct where I am going wrong.