1、如果使用属性驱动中的private User user; 那么表单的name要改成 user.xxx
如果用模型驱动的话 要把对象new出来private User user = new User();
2、注入service后还需要privet和setservice名
private LoginLogService loginLogService;
public void setLoginLogService(LoginLogService loginLogService) {
this.loginLogService = loginLogService;
}
如果没有会org.springframework.beans.NotWritablePropertyException: Invalid property 'loginLogService' of bean class [my.action.LoginAction]: Bean
property 'loginLogService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
struts2知识
最新推荐文章于 2022-11-12 13:17:26 发布
本文主要探讨了属性驱动和模型驱动的区别及应用方法。详细解释了如何修改表单名称以匹配属性驱动的要求,并介绍了如何创建对象以实现模型驱动。此外还讲解了依赖注入中setter方法的正确设置方式。
559

被折叠的 条评论
为什么被折叠?



