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 に答える