嗨,我正在尝试发布地图,但我仍然无法正常工作...有人可以帮我解决这个问题吗...?
我的代码基于这个例子: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...