Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
引用数据中带有注释的Spring SimpleFormController_Spring_Spring Mvc - Fatal编程技术网

引用数据中带有注释的Spring SimpleFormController

引用数据中带有注释的Spring SimpleFormController,spring,spring-mvc,Spring,Spring Mvc,如何使用SpringFormController注释编写referenceData方法。我有几个java.util.Map对象,最后在coomand对象中设置所有这些对象。如何使用Spring Form Controller返回此对象。 最初,我使用以下代码显示表单: @RequestMapping(method=RequestMethod.GET) public String initForm(Model map){ TestDTO test=new TestDTO(); map.attri

如何使用SpringFormController注释编写referenceData方法。我有几个java.util.Map对象,最后在coomand对象中设置所有这些对象。如何使用Spring Form Controller返回此对象。 最初,我使用以下代码显示表单:

@RequestMapping(method=RequestMethod.GET)
public String initForm(Model map){

TestDTO test=new TestDTO();
map.attribute("cmdtest",test);
return "test";

}
@ModelAttribute("customer")
public Model setup(Model map,HttpServletRequest request)
{
   Map testData=testService.getTestData(request)

 model.addAttribute("testData",testData);
return model;
}
如何在我的jsp页面中访问testData映射对象? 问候,


Raj

该地图作为customer.testData可用于jsp页面;“customer”是因为您在模型中将其命名为ModelAttribute,而“testData”是因为您在模型中将其命名为

<p>Here is your testData: ${customer.testData}</p>
这是您的测试数据:${customer.testData}


您的问题标题具有误导性。也许可以将其重命名为“Spring控制器注释”或“如何在jsp中访问Spring模型对象”