Getter和Setter-POJO对象-Struts2中的输入数据问题
我对struts2中的setter和getter方法有问题。 我有一张表格: ... +作业的所有输入字段/> 和操作:(addJob映射到此操作) 公共类InsertJobAction扩展了ActionSupport{ ... 私人作业作业=null; 公共字符串execute(){ jobService.insert(job);//此处job不为null;这是可以的 }Getter和Setter-POJO对象-Struts2中的输入数据问题,struts2,Struts2,我对struts2中的setter和getter方法有问题。 我有一张表格: ... +作业的所有输入字段/> 和操作:(addJob映射到此操作) 公共类InsertJobAction扩展了ActionSupport{ ... 私人作业作业=null; 公共字符串execute(){ jobService.insert(job);//此处job不为null;这是可以的 } 工作的接受者和接受者 } 此操作正常工作 我有一个类似的表单和动作,但是这个表单的输入字段少于第一个表单; 问题在于:
- 工作的接受者和接受者 }
Andrew我假设您正在使用会话存储数据,并且setters中的数据需要从会话中提取有效bean 基于动作状态,方法的调用顺序。例如,第一次运行POJF时不会调用构造函数,但第二次调用时会调用构造函数。另外,如果您正在提交表单数据,则只有在处理完数据后,执行才会运行。有关基于操作的调用的基本堆栈跟踪,请参见以下内容
Call Stack
## First Time Run ##
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
## Second Pass ##
DateBeanAction()
setSession(Map session)
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
## Submit ##
DateBeanAction()
setSession(Map session)
setBirthDate(Object birthDate)
setTodayDate(Object value)
setTomorrowDate(Object value)
setDesc(String desc)
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
你的帖子真的很难读。请使用标签显示代码,以便正确显示。