Skip to content

Conversation

@Dongnyoung
Copy link
Contributor

Hello,

This PR clarifies the Spring MVC documentation for View Resolvers.
The current example shows registry.jsp(); but does not explain what defaults are applied.

In this file: https://github.com/spring-projects/spring-framework/blob/main/framework-docs/modules/ROOT/pages/web/webmvc/mvc-config/view-resolvers.adoc

Problem

  • Readers may assume they must always configure a prefix and suffix manually.
  • In reality, registry.jsp() registers an InternalResourceViewResolver with sensible defaults.
  • The absence of this detail can cause confusion when JSP views are not resolved.

Changes Introduced

  • Added a [NOTE] block immediately after the JSP example.
  • The note clarifies that:
    • Default prefix: /WEB-INF/
    • Default suffix: .jsp
    • Explicit configuration is only required if JSP files are located in a different directory or use a different extension.
  • The application.properties example was intentionally omitted here, since it is more relevant to Spring Boot documentation.

Closes #35429

Thank you for reviewing.

Dongnyoung added 4 commits May 6, 2025 20:12
…ttpRequest

This pull request fixes a grammatical mistake in the JavaDoc of the setResponse method in MockClientHttpRequest.

- Original: "the this request"
- Changed to: "this request"

This change improves the clarity and quality of the documentation.

Signed-off-by: DongNyoung Lee <[email protected]>
Fix grammatical error in JavaDoc of setResponse method in MockClientHttpRequest.
Signed-off-by: DongNyoung Lee <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 5, 2025
@sdeleuze sdeleuze self-assigned this Sep 5, 2025
@sdeleuze sdeleuze added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 5, 2025
@bclozel
Copy link
Member

bclozel commented Sep 5, 2025

@Dongnyoung
Copy link
Contributor Author

I understand this is already covered in the Javadoc, thanks for pointing it out.

Would it still make sense to keep a short [NOTE] or at least a cross-reference in the reference docs?
While the defaults can indeed be found in the Javadoc, a brief mention in the documentation could make it easier for readers to quickly grasp the behavior without having to jump into the API docs.

Happy to adjust the PR accordingly if you think it adds value.

@sdeleuze
Copy link
Contributor

sdeleuze commented Sep 8, 2025

@Dongnyoung I don't think this is the right place for documenting such details, but I would suggest to rework your PR as an update of https://docs.spring.io/spring-framework/reference/web/webmvc-view/mvc-jsp.html to replace the XML bean declaration by a more high level JavaConfig configureViewResolvers(ViewResolverRegistry registry) code snippet displayed by default and a complementary <mvc:view-resolvers> XML one with a related note.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Sep 8, 2025
@Dongnyoung
Copy link
Contributor Author

Thanks a lot for the valuable feedback 🙏
I’ve reworked this change according to your suggestions (JavaConfig example as the default, XML <mvc:view-resolvers> as a note, and no duplication of defaults).

Opened a new PR at #35444 with the updated version.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 8, 2025
@sdeleuze sdeleuze added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Sep 8, 2025
@sdeleuze sdeleuze closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Clarify default prefix/suffix of registry.jsp()

4 participants