Spring MVC Configuration Fundamentals
Project Setup and Dependencies
Configure Maven dependencies for Spring MVC web applications:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-web-app</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<pr ...
Posted on Wed, 27 May 2026 19:10:51 +0000 by ankit17_ag
Creating a Spring MVC Project with Maven in Eclipse
This guide walks through setting up a Spring MVC project using Maven within the Eclipse IDE.
1. Create a Maven Web Project
In Eclipse, select File > New > Other > Maven > Maven Project.
Keep the default settings and click Next.
Choose the archetype maven-archetype-webapp and leave other options as default.
Fill in the project detai ...
Posted on Tue, 26 May 2026 22:15:57 +0000 by stringman
A Simple Example of AJAX in a Spring MVC Application
// Fetch book details via AJAX
$('.book-link').click(function(event) {
event.preventDefault();
const bookId = $(this).data('id');
fetchBookDetails(bookId);
});
// Test function to set a value
$('#testButton').click(function() {
$('#bookIsbn').val('Test ISBN');
});
});
function fetchBookDetails(bookId) {
$.ajax({
...
Posted on Mon, 18 May 2026 12:54:30 +0000 by Charles Wong
Understanding Servlet Filters and Spring MVC Interceptors
Servlet Filters
Filters are a core component of the Java Servlet specification, operating within the servlet container to pre-process requests and post-process responses. They execute before a request reaches a servlet and after the servlet generates a response, enabling tasks like logging, authentication, and data transformation.
Core Conecpts ...
Posted on Sun, 10 May 2026 04:21:31 +0000 by ajcether
Configuring CORS Support in Java Spring Applications
Cross-Origin Resource Sharing (CORS) is managed by setting specific HTTP response headers, primarily Access-Control-Allow-Origin, which dictates which external domains are permitted to access the resource. When a browser blocks a request due to CORS policy, the error typically resembles:
Access to XMLHttpRequest has been blocked by CORS policy: ...
Posted on Sat, 09 May 2026 13:12:34 +0000 by rageh
Implementing Cross-Origin Resource Sharing (CORS) in Spring MVC
Introduction to CORS
When discussing AJAX cross-domain requests, many developers first think of JSONP. JSONP has been widely used for years, but it has significant limitations. It works by injecting a <script> tag into the page to execute remote JavaScript, which can lead to XSS vulnerabilities if the source is compromised. Additionally, ...
Posted on Sat, 09 May 2026 06:27:51 +0000 by darkhappy
Implementing File Upload in Spring MVC Applications
Temporary Directory Setup
Before implementing file upload, configure the temporary directory where uploaded files are stored during processing.
Option 1: JVM parameter
mkdir -p /app/tmp
-Djava.io.tmpdir=/app/tmp
Option 2: Spring Boot configuration
spring:
servlet:
multipart:
location: /app/tmp
max-file-size: 500MB
max-r ...
Posted on Sat, 09 May 2026 01:09:20 +0000 by The Cat
Essential Spring MVC Annotations for Web Development
@Controller
Applied at the class level, @Controller marks a class as a Spring MVC controller and registers it as a Spring bean. The DispatcherServlet automatically detects such classes and routes incoming HTTP requests to methods annotated with @RequestMapping. This annotation is specifically intended for web controllers—use @Component or other ...
Posted on Fri, 08 May 2026 21:44:59 +0000 by weiwei
Spring MVC: Mappers, Adapters, and Controllers
Spring MVC's core components—HandlerMapping, HandlerAdapter, and Controller—each have distinct responsibilities.
Responsibilities
HandlerMapping (Mapper): Maps incoming HTTP requests to appropriate handlers based on the request URL. It associates request paths with controller beans.
HandlerAdapter (Adapter): Invokes the actual handler metho ...
Posted on Thu, 07 May 2026 06:42:14 +0000 by goa103
Detailed Guide to Spring MVC JSON Parameter Handling and Common Pitfalls
Recently, I decided to stop using sessions and explore tokens for a more secure and robust approach, while also creating a unified interface for both browsers and mobile apps. I refactored a practice project's frontend to use Ajax entirely, keeping Spring MVC for view controller forwarding. This deepened my understanding of JSON data transmissi ...
Posted on Thu, 07 May 2026 00:45:21 +0000 by Haktar