我有一个表单和bean。从bean我正在重新审视DTO中的值和设置。这也是FORM的设置。但是getter属性值为null。我不知道这里有什么问题。有人可以就此提出建议吗?
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
public class LoginForm extends XFormBase {
private String title;
public void setTitle(String title) {
this.titleValue = title;
System.out.println(" Form set"+titleValue);
}
public String getTitle() {
this.title = titleValue;
System.out.println(" Form get"+titleValue);
return title;
}
}
答案 0 :(得分:0)
看起来有一个错误:
setTitle
方法,不设置title
,而是设置titleValue
!
我猜想正确的实现是:
public void setTitle(String title) {
this.title = title;
System.out.println(" Form set"+title);
}
答案 1 :(得分:0)
尝试使用此功能。我怀疑你的getter和setter实现中存在错误
public class LoginForm extends XFormBase {
private String title;
public void setTitle(String titleValue ) {
this.title= titleValue;
System.out.println(" Form set"+this.title);
}
public String getTitle() {
System.out.println(" Form get"+this.title);
return this.title;
}
}