1

我有一个哈希图如下:

HashMap<String, Object> myHashMap = new HashMap<String, Object>();

其中的数据如下所示:

{CompanyName=null, CompanyId=null}

我想迭代它并在我的表示层中显示它的值。我将它添加到我的模型中,如下所示:public String

showPage(Map model)
{
        HashMap<String, Object> myHashMap =  new HashMap<String, Object>();

        model.put("company", myHashMap);

        return "page";
}

我的 JSP

<h1>${companyName}</h1>

<fieldset>
    <p>
        <form:label path="companyName" cssErrorClass="form-error">Issuer Name</form:label>
    </p>
</fieldset>
<input type="submit" value="Next" class="round blue ic-right-arrow" />

我收到以下错误:

Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'companyName' of bean class [java.util.HashMap]: Bean property 'companyName' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
4

1 回答 1

0

像下面这样尝试它可能会起作用

${company["CompanyName"]} 
于 2012-08-22T14:09:24.247 回答