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

Bài đăng

Hiển thị các bài đăng có nhãn spring

[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" );...

[Shiro][Spring-MVC] Apache Shiro with Spring framework, Java config and WebApplicationInitializer

Recently I was adding  Apache Shiro  security framework to Spring based web application which is using Java config and doesn't have xml configuration at all, not even web.xml Apache Shiro documentation is mostly using xml examples so it took some time to put it all together in Java config based application. Central part of Shiro security is  a realm. Here is how official Shiro documentation defines realms: " A Realm is a component that can access application-specific security data such as users, roles, and permissions. The Realm translates this application-specific data into a format that Shiro understands so Shiro can in turn provide a single easy-to-understand  Subject  programming API no matter how many data sources exist or how application-specific your data might be ." Shiro comes with number of out-of-the-box Realm  implementations that connects directly to database, to LDAP, etc, but in this example we will use custom Realm ...