From 1abd1d767d4119c42d9f2ba2fac3849f17ecb6e1 Mon Sep 17 00:00:00 2001
From: DongNyoung Lee <121621378+Dongnyoung@users.noreply.github.com>
Date: Mon, 8 Sep 2025 22:11:15 +0900
Subject: [PATCH] Update mvc-jsp.adoc
See gh-35444
Signed-off-by: DongNyoung Lee <121621378+Dongnyoung@users.noreply.github.com>
---
.../ROOT/pages/web/webmvc-view/mvc-jsp.adoc | 40 ++++++++++++++-----
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/framework-docs/modules/ROOT/pages/web/webmvc-view/mvc-jsp.adoc b/framework-docs/modules/ROOT/pages/web/webmvc-view/mvc-jsp.adoc
index 6ca828bef56..920081c0b78 100644
--- a/framework-docs/modules/ROOT/pages/web/webmvc-view/mvc-jsp.adoc
+++ b/framework-docs/modules/ROOT/pages/web/webmvc-view/mvc-jsp.adoc
@@ -9,19 +9,41 @@ The Spring Framework has a built-in integration for using Spring MVC with JSP an
When developing with JSPs, you typically declare an `InternalResourceViewResolver` bean.
-`InternalResourceViewResolver` can be used for dispatching to any Servlet resource but in
-particular for JSPs. As a best practice, we strongly encourage placing your JSP files in
-a directory under the `'WEB-INF'` directory so there can be no direct access by clients.
+`InternalResourceViewResolver` can be used for dispatching to any Servlet resource but in particular for JSPs.
+As a best practice, we strongly encourage placing your JSP files in a directory under the `WEB-INF` directory so there can be no direct access by clients.
-[source,xml,indent=0,subs="verbatim,quotes"]
+[source,java]
----
-
-
-
-
-
+@EnableWebMvc
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+ @Override
+ public void configureViewResolvers(ViewResolverRegistry registry) {
+ // Use sensible defaults
+ registry.jsp();
+ // Example of customizing:
+ // registry.jsp("/WEB-INF/views/", ".jsp");
+ }
+}
----
+[NOTE]
+====
+For legacy XML configuration:
+
+[source,xml]
+----
+
+
+
+----
+
+Prefer JavaConfig for new applications.
+====
+
+[.text-muted]
+See the Javadoc of ViewResolverRegistry#jsp() for default prefix and suffix values.
[[mvc-view-jsp-jstl]]
== JSPs versus JSTL