Skip to Main Content
Spring MVC Beginner's Guide
book

Spring MVC Beginner's Guide

by Amuthan Ganeshan
June 2014
Beginner to intermediate content levelBeginner to intermediate
304 pages
7h 25m
English
Packt Publishing
Content preview from Spring MVC Beginner's Guide

Time for action – intercepting offer page requests

For example, consider a situation where you want to show the special offer products page to only those users who have a valid promo code. The others trying to access the special offer products page with an invalid promo code should be redirected to an error page. Achieve this piece of functionality with the help of the interceptor by performing the following steps:

  1. Create a class named PromoCodeInterceptor under the com.packt.webstore.interceptor package in the source folder src/main/java and add the following code into it:
    package com.packt.webstore.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Spring MVC Beginner's Guide - Second Edition

Spring MVC Beginner's Guide - Second Edition

Amuthan Ganeshan
Spring MVC: Designing Real-World Web Applications

Spring MVC: Designing Real-World Web Applications

Shameer Kunjumohamed, Hamidreza Sattari, Alex Bretet, Geoffroy Warin

Publisher Resources

ISBN: 9781783284870Supplemental Content