Getter and Setter - POJO object - Problem with input data in Struts2

Posted by andreimladin on Stack Overflow See other posts from Stack Overflow or by andreimladin
Published on 2010-01-21T21:46:40Z Indexed on 2010/05/29 6:02 UTC
Read the original article Hit count: 452

Filed under:

I have a problem with setter and getter method in struts2. I have a form : ... + all input fields of job/>

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 }

  • getter and setter for job }

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

© Stack Overflow or respective owner

Related posts about struts2