eclipse中的get/set功能的一个bug
今天发现一个问题,页面中的值一部分不能传到后台(用的struts2+hibernate+spring),没发现哪里有写错,看了一下POJO,原来是eclipse的bug。
当属性中第二个字母是大写的时候,使用eclipse的generater set/get功能的时候
会这样,get,set方法后的p是小写,而不是大写。
所以使用struts没办法从页面到后台传值。
//当属性中第二个字母是大写的时候,使用eclipse的generater set/get功能的时候
//会这样,get,set方法后的p是小写,而不是大写。
//所以使用struts没办法从页面到后台传值。
private Date pStartDatePWSC;
public Date getpStartDatePWSC() {
return pStartDatePWSC;
}
public void setpStartDatePWSC(Date pStartDatePWSC) {
this.pStartDatePWSC = pStartDatePWSC;
}
:idea: 我无知了。
Utility method to take a string and convert it to normal Java variable * name capitalization. This normally means converting the first * character from upper case to lower case, but in the (unusual) special * case when there is more than one character and both the first and * second characters are upper case, we leave it alone.
property的命名要遵循第二个字母不能大写。因为java是国外开发的,它对命名遵循了英语的一个规范:大部分的单词第二个字母都是小写的,除了URL之类的单词
不知所云...
拜托,这根本不是eclipse的bug,你属性都不遵守pojo规范。。。建议你自己去查查pojo的规范,对命名的要求是什么~
还要注意插件为hibernate自动生成的javabean。