【发布时间】:2013-09-24 15:13:02
【问题描述】:
Struts (1.38) 菜鸟,我收到以下错误: 名称 hsForm 下的 bean 的属性 hs.hasRelationshipToTeam 没有可用的 getter 方法。 有人告诉我在 HSDivForm 中创建一个 getHs 和 setHs 方法,但这就是问题所在吗?或者我该怎么做?
我的豆子:
public class HS extends Entry implements Serializable,Cloneable {
private Boolean hasRelationshipToTeam = false;
public boolean isHasRelationshipToTeam()
{ return hasRelationshipToTeam; }
public void setHasRelationshipToTeam(boolean hasRelationshipToTeam)
{ this.hasRelationshipToTeam = hasRelationshipToTeam; }
}
我的表格:
import my.bean.HS;
public class HSForm extends ActionForm
{
private HS hs = new HS();
public HSForm()
{ super(); }
}
我的jsp:
<html:form styleId="HSDivForm" action="/disclosure/hsAction" >
<table>
<tr id = "q-rel">
<td colspan="2" align="center">
<br />
Is there a team relationship?
<br />
Yes<html:radio property="hs.hasRelationshipToTeam" value="yes" />
No<html:radio property="hs.hasRelationshipToTeam" value="no" />
</td>
</tr>
</table>
</html>
【问题讨论】:
-
Beans 与
get和set一起使用。另外,您在isHasRelationshipToTeamy中有y -
@SotiriosDelimanolis bean 也可以使用
is作为前缀 - 只要属性是boolean -
对不起,你不知何故进入了那里。 . .它在我的代码上是正确的,但仍然没有运气。