Could someone explain why the setWleDao() method was being called with a null argument in the following code? The only way I could get it to work (setting the wleDao field) was to change the bean wiring to use a constructor. I was under the impression that it should work with a setter or a constructor.
This is the config from the xml file:Code:public class SignInCtlr extends SimpleFormController { private WleDao wleDao; public SignInCtlr(WleDao wleDao) { setCommandClass(SignInFrmData.class); this.wleDao = wleDao; } protected ModelAndView onSubmit(Object cmd, BindException errs) throws Exception { SignInFrmData sifd = (SignInFrmData) cmd; String view = sifd.getView(); sifd.setWle(wleDao.getWaitlistEntries()); return(new ModelAndView(view, "sifd", sifd)); } public void setWleDao(WleDao wledao) { this.wleDao = wleDao; } }
Code:<bean id="signInCtlr" class="SignInCtlr"> <constructor-arg> <ref bean="wleDao" /> </constructor-arg> <property name="sessionForm"> <value>true</value> </property> <property name="commandName"> <value>sifd</value> </property> <property name="commandClass"> <value>SignInFrmData</value> </property> <property name="validator"> <ref bean="signInValidate" /> </property> <property name="formView"> <value>signInView</value> </property> <property name="successView"> <value>signInFrmDataView</value> </property> <!-- <property name="wleDao"> <ref bean="wleDao" /> </property> --> </bean>


Reply With Quote