你好 可能这是一个愚蠢的问题,但我是 Spring 框架的新手。请帮忙
web.xml
<display-name>demo name</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
应用程序上下文.xml
<bean id="loginInfo" class="com.saurabh.dto.LoginInfo"></bean>
<bean id="contactInfo" class="com.saurabh.dto.ContactInformation"></bean>
<bean id="userDTO" class="com.saurabh.dto.UserDTO" scope="request" abstract="false">
<property name="login" ref="loginInfo"></property>
<property name="contact" ref="contactInfo"></property>
</bean>
控制器
@Controller
public class LogonController {
@RequestMapping(value = "/requestLogon.htm",method={RequestMethod.POST,RequestMethod.GET})
public String registerUser(@ModelAttribute("userDTO") UserDTO user, BindingResult result, HttpServletRequest request, HttpServletResponse response,
HttpSession session)throws Exception{
现在的问题是,在控制器 UserDTO 用户中,我将登录属性设置为 null,但根据接线,我已经注入了它。请解释问题..