Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding a login page


We are going to use Spring Security features to restrict access to the add products page. Only an authorized user with a valid username and password will be able to access the add products page. Let's see how we can do this in Spring MVC with the following steps:

  1. We open pom.xml, which can be found under the project root folder itself.

  2. We will be able to see some tabs at the bottom, under the pom.xml file; we select the Dependencies tab and click on the Add button of the Dependencies section.

  3. A Select Dependency window will appear; here, we enter Group Id as org.springframework.security, Artifact Id as spring-security-config, Version as 3.1.4.RELEASE, and select Scope as compile and click on the OK button.

  4. Similarly, we add one more dependency Group Id as org.springframework.security, Artifact Id as spring-security-web, Version as 3.1.4.RELEASE, and select Scope as compile and click on the OK button. And most importantly, we save pom.xml.

  5. Now, we go to the...