• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

map element inside bean is throwing an error

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an applicationcontext.xml which looks as below. It is throwing an error at each line
1. Element map is not allowed here
2. cannot resolve symbol entry
3. cannot resolve symbol bean
4. cannot resolve symbol property
...
...


<bean id="sampleLookupServices" class="com.springweb.ch3.MapCustomerLookupService">

<map>
<entry key="a1234">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1234"/>
<property name="firstName" value="Rod"/>
<property name="lastName" value="Johnson"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1235">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1235"/>
<property name="firstName" value="Julia"/>
<property name="lastName" value="Roberts"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1236">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1236"/>
<property name="firstName" value="Alan"/>
<property name="lastName" value="Springer"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
</map>

</bean>
 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me post the whole file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="shape1" class="coreservlets.Rectangle">
<property name="length" value="10"/>
<property name="width" value="20"/>
</bean>
<bean id="shape2" class="coreservlets.Circle">
<constructor-arg value="10"/>
</bean>

<bean id="colorPreferences" class="com.springweb.ch3.ColorPreferences" scope="request" >
<property name="background" value="#fdf5e6"/>
<property name="foreground" value="black"/>
</bean>

<bean id="sampleLookupServices" class="com.springweb.ch3.MapCustomerLookupService">

<map>
<entry key="a1234">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1234"/>
<property name="firstName" value="Rod"/>
<property name="lastName" value="Johnson"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1235">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1235"/>
<property name="firstName" value="Julia"/>
<property name="lastName" value="Roberts"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1236">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1236"/>
<property name="firstName" value="Alan"/>
<property name="lastName" value="Springer"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
</map>

</bean>
</beans>
 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got the answer. These map elements are to be placed between property elements as below
<property name="xxx">
<map>...</map>
</property>
 
I'm so happy! And I wish to make this tiny ad happy too:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic