aspose file tools*
The moose likes JSF and the fly likes Spring IOC issues in MVC WebApplication with JSF integration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Spring IOC issues in MVC WebApplication with JSF integration" Watch "Spring IOC issues in MVC WebApplication with JSF integration" New topic
Author

Spring IOC issues in MVC WebApplication with JSF integration

Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Hello All,

I am getting null pointer exception while using spring's IOC feature in my application.

I have created one Spring + JSF Application in Eclipse ID given instruction at link http://www.javabeat.net/articles/39-integrating-spring-and-jsf-3.html.
This is working fine.

I tried to modify this code and instead of initializing the Map from the default constructor I have added below code in applicationContext.xml like

<util:map id="stockSymbolsAndValuesMap" map-class="java.util.HashMap">
<entry key="AAA" value="100"></entry>
<entry key="BBB" value="200"></entry>
<entry key="CCC" value="300"></entry>
<entry key="DDD" value="400"></entry>
<entry key="EEE" value="500"></entry>
</util:map>

and add this id's ref something like below.

<bean id="stockBean"
class="net.javabeat.articles.springjsf.introduction.StockValueFetcher">
<property name="stockBeanValue" ref="stockBean"></property>
</bean>


and modified the bean some thing like

public class StockValueFetcher {

private Map<String, String> stockSymbolsAndValues;
// with some getters and setters

}

while taking this map to my public String findStockValue() method I am getting null when I do stockSymbolsAndValues.containsKey(symbolName);.

I did this map injection in plain java main spring program and its working fine. So, in this case am I doing anything wrong or missing anything. Please guide me on this.

Thanks And Regards
Jaik






 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring IOC issues in MVC WebApplication with JSF integration