日期:2014-05-19  浏览次数:20640 次

Exception accessing property uId for bean houseInfo: java.lang.NoSuchMethodException: Unknown proper
报错总是说我的houseInfo中没有uId ,但是我在HouseInfo(实体类中)仔细看过了 private int uId ; 和相应的get set 都写了啊
XML code
javax.servlet.jsp.JspException: Exception accessing property uId for bean houseInfo: java.lang.NoSuchMethodException: Unknown property 'uId'
    at org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.java:194)
    at org.apache.struts.taglib.logic.EqualTag.condition(EqualTag.java:46)
    at org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(ConditionalTagBase.java:174)
    at org.apache.jsp.jsps.list_jsp._jspx_meth_logic_005fequal_005f0(list_jsp.java:991)
    at org.apache.jsp.jsps.list_jsp._jspService(list_jsp.java:268)code]
[code=Java]<logic:iterate id="houseInfo" name="list">
                        <tr>
                            <td width='250' class="table_title">
                                <bean:write name="houseInfo" property="title" />
                                <logic:equal name="houseInfo" property="uId" value="${sessionScope.userId}">
                                    [<a href="...">编辑</a>][<a href="...">删除</a>]
                                </logic:equal>


------解决方案--------------------
uId虽然不是关键字,但相应的getter和setter应该是:
Java code

    public Long [color=#FF0000]getuId[/color]() {
        return uId;
    }

    public void [color=#FF0000]setuId[/color](Long uId) {
        this.uId = uId;
    }

------解决方案--------------------
get/set方法后面的第二个字母不要是大写,不然就会有问题