struts 2がFreemarkerと結合して値をとる場合、比較的奇妙な現象です.
1311 ワード
たとえば、actionにはtCountという変数があります.コードは次のとおりです.
freemarkerで値を取る場合、通常の取り方は以下の通りです.
${tCount}および${basicName}
しかし、奇妙な現象が発生し、システムはtCountが定義されていないと報告し、basicNameは問題ないと報告します.
何度も考えてみたが、何気なく試してみると、${TCount}が正常に取れることが分かった.
変数の最初のアルファベットが小文字で2番目が大文字の場合、画面の値を取る場合、最初の小文字も大文字に変換する必要があります.
不思議なことに、どんな特性なのか分かりません.
知っている学生が来て討論してもいいです.
/**
* tCount.
*/
private Integer tCount;
/**
* basicName.
*/
private String basicName;
/**
* tCount .
* @param tCount Integer tCount
*/
public void setTCount(Integer tCount) {
this.tCount = tCount;
}
/**
* tCount .
* @return Integer tCount
*/
public Integer getTCount() {
return this.tCount;
}
/**
* basicName .
* @param basicName String basicName
*/
public void setBasicName(String basicName) {
this.basicName = basicName;
}
/**
* basicName .
* @return String basicName
*/
public String getBasicName() {
return this.basicName;
}
freemarkerで値を取る場合、通常の取り方は以下の通りです.
${tCount}および${basicName}
しかし、奇妙な現象が発生し、システムはtCountが定義されていないと報告し、basicNameは問題ないと報告します.
何度も考えてみたが、何気なく試してみると、${TCount}が正常に取れることが分かった.
変数の最初のアルファベットが小文字で2番目が大文字の場合、画面の値を取る場合、最初の小文字も大文字に変換する必要があります.
不思議なことに、どんな特性なのか分かりません.
知っている学生が来て討論してもいいです.