spring - modelMap.put() v/s modelMap.addAttribute() -
in spring, difference between
modelmap.put("key",value);
and
modelmap.addattribute("key",value);
addattributes implies check not null in attribute name -> see sources
/** * add supplied attribute under supplied name. * @param attributename name of model attribute (never <code>null</code>) * @param attributevalue model attribute value (can <code>null</code>) */ public modelmap addattribute(string attributename, object attributevalue) { assert.notnull(attributename, "model attribute name must not null"); put(attributename, attributevalue); return this; }
Comments
Post a Comment