Spring 3 's MVC & Security Simple Integration Development (i) _spring-security

Source: Internet
Author: User

Original link: http://sarin.iteye.com/blog/829738

The Spring MVC module is a concise Web application framework that implements the MVC pattern to handle HTTP requests and responses. Compared to the Struts series, SPRINGMVC's MVC is more pronounced, separating the controller and view definitions completely, and they don't need to be under a single namespace. It has all the benefits of spring, and the beans are more comfortable to configure. The annotation configuration of Spring 3 makes code writing more elegant. This example combines the spring MVC with the security framework for a small integration, only work can explain, not detailed exploration of its principles.
The first is to build the project, do a simple message publishing function, the code structure below, the use of Maven can be very good management dependencies:

The hierarchy is used, but the database operation is not used, just a short description, which is used by the security framework to authenticate the user later. Here's a look at the dependencies, so you can get a clearer picture of the spring hierarchy:

     First look at the most basic Web Deployment profile Web.xml, write the configuration that is used, Spring 3 uses Dispatcherservlet to distribute the request, and the security framework threaded the filter mechanism for safe handling. The configuration is simple, like the following, the Web request uses the. htm form:  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ? XML version = "1.0" encoding = "UTF-8"?> < Web-app Version = "2.5" xmlns = "Http://java.sun.com/xml/ns/javaee" &nbs p;    xmlns:xsi = "Http://www.w3.org/2001/XMLSchema-instance"      xsi: schemalocation= "Http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >        < Context-param >          < Param-value >         /web-inf/board-service.xml          /web-inf/board-security.xml          </ Param-value >      </context-param >      < listener >      < listener-class > org.springframework.web.context.contextloaderlistener</listener-class >      </ Listener >      < filter >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.