and action: (addJob is mapped at this action)
public class InsertJobAction extends ActionSupport{
...
private Job job = null;
public String execute(){
jobService.insert(job); //here job is not null; that is ok
}
this action works correctly;
I have a similar form and action, but the input fields from thisform are less than first form;
The problem is here: in execute() of the second action job is null. Why??
Does depend it of fields noumber ??
I have 2 constructors in my Job class one with no params, and one with all params for every field of class;
I made debug with Log4j ...and in first case there arrives in Job constructor in the second not. Why??When it calls constructor???
When are called the setter and getter methodsb, before or after execute() method??? And when i have a form with input data?? Are called setter methods before execute() method?
I'm very confusely because in a case it works without problems, but in the second case it doesn't
Thanks,
Andrew
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
我假设您正在使用会话来存储数据,并且 setter 中的数据需要从会话中提取有效的 bean。
基于操作说明调用方法的顺序。例如,第一次运行 POJF 时不会调用构造函数,但第二次运行时会调用该构造函数。此外,如果您提交表单数据,则只有在处理数据后才会运行执行。请参阅以下内容,了解基于操作的调用的基本堆栈跟踪。
I am assuming you are using session to store data and the data in the setters require a valid bean pulled from the session.
Based on the action states the order in which the methods are called. For example the constructor is not called the first time the POJF is run, however the second pass does. Also if you are submitting form data then the execute will only run once the data has been processed. See the following for a basic stack trace of calls based on actions.