Hi,
I was under the impression that the bean configuration ,for my example below "worklistManager", will provide me with the valid instance of the object on the controller and hence i can call the getXXX methods on the object.
I keep getting a null pointer on the following lineCode:public class LandingPageController extends MultiActionController { protected final Log logger = LogFactory.getLog(getClass()); private WorklistManager worklistManager; public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String now = (new java.util.Date()).toString(); List<WorklistItem> witems = worklistManager .getAllWorklistItemsByUser(""); Map<String, Object> myModel = new HashMap<String, Object>(); myModel.put("now", now); myModel.put("witems", witems); return new ModelAndView("landingpage", "model", myModel); } public void setWorklistManager(WorklistManager worklistManager) { this.worklistManager = worklistManager; } }
List<WorklistItem> witems = worklistManager
.getAllWorklistItemsByUser("");
In my config file i have the following
Is my understanding incorrect? Can any one suggest what i need to do in the controller code to avoid a NPE.Code:<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/> <property name="url" value="JDBC_URL"/> <property name="username" value="USER_NAME"/> <property name="password" value="PASSWORD"/> </bean> <bean id="worklistManager" class="eirapp.service.WorklistManagerImpl"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="landingpageController" class="eirapp.web.LandingPageController"> <property name="worklistManager" ref="worklistManager" /> </bean>
Thanks,


Reply With Quote