How to put value of textarea in spring MVC?
How to load content into a textarea using spring mvc, for ex开发者_如何学JAVAample - from database ?
Write an MVC Controller with an method that returns a ModelAndView with an attribute that is contains the content and write a JSP Pages (the view from ModelAndView) that uses creates a text area with the attribute from the Modell
@Controller
@RequestMapping("/demo/**")
class Demo{
@Request
public ModelAndView() {
ModelMap modelMap = new ModelMap();
modelMap.putAttribute("content", "Hello World, this is a sunny day...");
return new ModelAndView("demoView", modelMap);
}
}
demoView.jsp
...
<textarea name="input" cols="50" rows="10"><c:out value="content"/></textarea>
...
精彩评论