Chuyển đến nội dung chính

Bài đăng

Đang hiển thị bài đăng từ Tháng 5, 2017

[SpringMVC] Review something in Spring MVC project

1/ Some note: - web.xml : listener, filter, dispatch Sevlet. - [name]-servlet : bean. - ModelAndView : Enable return view and model. - Model : an interface, enable add model with attribute. - ModelMap : and class , enable add model with attribute. 2/ How to using model and view (*.jsp): - DTO: private String name ; private String password ; private String salt ; private String username ; private Date createTime ; private Date updateTime ; - Controller UserDto user = new UserDto(); user .setName( "vuphan" ); model .addAttribute( "user" , user ); - View:         < div >< h2 > show user name: ${user.name} </ h2 ></ div > 3/ About Navigation: - Show view: ex with page ' test.jsp '  @RequestMapping (method = RequestMethod. GET ) public String reloadPage(ModelMap model ) { UserDto user = new UserDto(); user .setName( "vuphan" );