Struts(1.38)noob,並且出現以下錯誤: 沒有getter方法可用於名爲hsForm的bean的屬性hs.hasRelationshipToTeam。 我被告知要在HSDivForm中創建一個getHs和setHs方法,但這是問題所在嗎?或者我該怎麼做呢?沒有getter方法可用於名稱爲bean的屬性
我的豆:
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>
豆與'get'和'set'一起工作。另外,你在'isHasRelationshipToTeamy'中有'y' –
@SotiriosDelimanolis bean也以'is'作爲前綴 - 只要屬性是'boolean' –
對不起,那個y不知怎麼進到那裏。 。 。這是對我的代碼,但沒有運氣。 – sharcfinz