我有这样的代码。
@RequestMapping(value="/persons",method=RequestMethod.POST) public @ResponseBody String addUser(@RequestParam String name){
returnText=name;
//List<Person> personList = personService.getAllzonedetails(returnText);
System.out.println(returnText);
//model.addAttribute("personsajax", personList);
return **returnText**;
}
@RequestMapping(value = "/persons", method = RequestMethod.GET)
public String getPersons(Model model) {
newvariable = returnText;
System.out.println(newvariable);
logger.debug("Received request to show all persons");
// Retrieve all persons by delegating the call to PersonService
List<Person> persons = personService.getAll();
List<Person> persons1 = personService.getAllzonedetails(newvariable);
// Attach persons to the Model
model.addAttribute("persons", persons);
model.addAttribute("personsajax", persons1);
// This will resolve to /WEB-INF/jsp/personspage.jsp
return "personspage";
}
我想在 System.out.println(newvariable) 中获取 returnText 帖子值;在get方法中传递jsp页面。
在jsp中传递post值的任何其他方式。
谢谢...