[英]No getter method for property
嗨,我正在嘗試使用struts將一個bean放入我的jsp代碼中,我在jsp頁面中使用的bean是:但是每當我運行jsp時,我都會收到
Bean:“ unitForm”的屬性:“ testData.team.type”沒有獲取方法。
我正在嘗試將棒球寫到我的JSP頁面。
我的操作表單的代碼是:
import com.TestGettingData;
import org.apache.struts.action.ActionForm;
public class UnitForm extends ActionForm {
private TestGettingData testData = new TestGettingData();
public TestGettingData getTestData() {
return testData;
}
public void setTestData(TestGettingData testData) {
this.testData = testData;
}
}
測試數據類具有:
public class TestGettingData extends Sport{
private String team = "Yankees";
private String position = "short stop";
public void setTeam(String tm) {
team = tm; }
public String getTeam() {
return team; }
public void setPosition(String po) {
position = po; }
public String getPosition() {
return position;
}
}
最后是我的體育課:
public class Sport{
public String type = "baseball";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
取而代之的testData.team.type
,嘗試testData.type
。 type
是testData
中的屬性,不在team
。
更新資料
${unitForm.testData.type}
應該在您的JSP中顯示“棒球”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.