こんにちは、マップを投稿しようとしていますが、まだうまくいきません...誰か助けてくれませんか...?
私のコードはこの例に基づいています: spring-mvc-hashmap-form
これが私の実装です:
JSP (これは、マップがモデル内にあるフォーム内にあります):
<c:set var="var1" value="${map['product.h1.title']}"/>
<input style="display: none;" type="text" name="mapConfigs['${var1.key}']" value="${var1.id}"/>
<input style="display: none;" type="text" name="mapConfigs['${var1.key}']" value="${var1.key}"/>
<input type="text" class="titulos" name="mapConfigs['${var1.key}']" value="${var1.value}"/>
DTO フォーム:
public class MapConfigurationsForm {
private Map<String, SystemConfiguration> mapConfigs;
public MapConfigurationsForm(){
this(null);
}
public MapConfigurationsForm(Map<String, SystemConfiguration> mapConfigs) {
this.mapConfigs = mapConfigs;
}
public Map<String, SystemConfiguration> getMapConfigs() {
return mapConfigs;
}
public void setMapConfigs(Map<String, SystemConfiguration> mapConfigs) {
this.mapConfigs = mapConfigs;
}
これは、コントローラーで取得することを期待しているものです。
@RequestMapping(value = "/oferta_producto", method= RequestMethod.POST)
public String postOfertaProducto(HttpServletRequest request, @ModelAttribute("configs") MapConfigurationsForm confs, ModelMap map) {
システム構成:
public class SystemConfiguration {
private Long id;
private String key;
private String value;
//Getter.... Setter... Etc...