Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Spring MVC Beginner's Guide

You're reading from   Spring MVC Beginner's Guide Unleash the power of the latest Spring MVC 4.x to develop a complete application

Arrow left icon
Product type Paperback
Published in Jul 2016
Last Updated in Feb 2025
Publisher
ISBN-13 9781785880636
Length 350 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Ganeshan Ganeshan
Author Profile Icon Ganeshan
Ganeshan
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Configuring a Spring Development Environment FREE CHAPTER 2. Spring MVC Architecture – Architecting Your Web Store 3. Control Your Store with Controllers 4. Working with Spring Tag Libraries 5. Working with View Resolver 6. Internalize Your Store with Interceptor 7. Incorporating Spring Security 8. Validate Your Products with a Validator 9. Give REST to Your Application with Ajax 10. Float Your Application with Web Flow 11. Template with Tiles 12. Testing Your Application Appendix A. Using the Gradle Build Tool 1. Appendix B. Pop Quiz Answers

RedirectView


In a web application, URL redirection or forwarding is the technique of moving visitors to a different web page than the one they requested. Most of the time, this technique is used after submitting a web form to avoid resubmission of the same form due to pressing the browser's back button or refresh. Spring MVC has a special View object that handles redirection and forwarding. To use a RedirectView (org.springframework.web.servlet.view.RedirectView) with our Controller, we simply need to return the target URL string with the redirection prefix from the Controller. There are two redirection prefixes available in Spring MVC:

  • redirect

  • forward

Time for action - examining RedirectView

Though both redirection and forwarding are used to present a different web page than the one requested, there is a small difference between them. Let's try to understand them by examining them:

  1. Open our HomeController class and add one more request mapping method as follows:

          @RequestMapping("/welcome...
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Spring MVC Beginner's Guide
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon