[英]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.