private Integer iDisplayLength ;
public Integer getIDisplayLength() {
return iDisplayLength;
}
public void setIDisplayLength(Integer iDisplayLength) {
this.iDisplayLength = iDisplayLength;
}
如果请求包含iDisplayLength
,则设置完美,我可以看到实际的价值。但是当响应返回(json-response)时,它会返回
IDisplayLength
代替iDisplayLength
对我来说似乎是一个错误。我做错了吗?那些 getter 和 setter 不正确吗?
我的 struts.xml 看起来像:
<action name="c/list" class="actions.MyAction" method="list">
<result name="*" type="json"></result>
</action>
更新
复制它用来计算字段名称的方法后:
public static void main(String[] args) throws Exception {
Class clazz = new IoAction().getClass();
BeanInfo info = getBeanInfoIgnoreHierarchy(clazz);
PropertyDescriptor[] props = info.getPropertyDescriptors();
boolean hasData = false;
for (PropertyDescriptor prop : props) {
System.out.println("Field Name : "+prop.getName());
}
}
其中IoAction
有 getter/setter,例如:
public String getISortCol_0() {
return iSortCol_0;
}
public void setISortCol_0(String iSortCol_0) {
this.iSortCol_0 = iSortCol_0;
}
上面的代码将字段名称打印ISortCol_0
为不正确(恕我直言),它应该返回iSortCol_0
它是 java 反射 API 中的错误吗?