ITeye博客

eclipse中的get/set功能的一个bug

mousepc · 2012-03-08 15:16 · struts · eclipse · 编程语言 · Markdown

今天发现一个问题,页面中的值一部分不能传到后台(用的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;
}

评论(5)

  1. #5 楼 · mousepc · 2012-03-09 10:43

    gklovejava writes:

    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之类的单词

    :idea: 我无知了。

  2. #4 楼 · gklovejava · 2012-03-09 10:24

    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之类的单词

  3. #3 楼 · shirne · 2012-03-09 10:14

    不知所云...

  4. #2 楼 · gklovejava · 2012-03-09 09:56

    拜托,这根本不是eclipse的bug,你属性都不遵守pojo规范。。。建议你自己去查查pojo的规范,对命名的要求是什么~

  5. #1 楼 · liangxgcool · 2012-03-08 16:56

    还要注意插件为hibernate自动生成的javabean。

评论功能维护中,当前仅展示历史评论。