private Integer iDisplayLength ;
public Integer getIDisplayLength() {
return iDisplayLength;
}
public void setIDisplayLength(Integer iDisplayLength) {
this.iDisplayLength = iDisplayLength;
}
リクエストに が含まれている場合iDisplayLength
、それは完全に設定されており、動作中の値を確認できます。しかし、応答が返されると (json-response)、返されます
IDisplayLength
それ以外のiDisplayLength
私にはバグのようです。私はそれを間違っていますか?それらのゲッターとセッターは間違っていますか?
私のstruts.xmlは次のようになります:
<action name="c/list" class="actions.MyAction" method="list">
<result name="*" type="json"></result>
</action>
アップデート
https://github.com/apache/struts2/blob/STRUTS_2_3_15_X/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.javaでプラグインのソース コードを確認しました。
フィールドの名前を把握するために使用するメソッドを複製した後:
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
のようなゲッター/セッターがあります:
public String getISortCol_0() {
return iSortCol_0;
}
public void setISortCol_0(String iSortCol_0) {
this.iSortCol_0 = iSortCol_0;
}
そして、上記のコードISortCol_0
は間違っているフィールド名を出力します(私見)、返されるべきiSortCol_0
でした Is it a bug in the Java Reflection API ?