Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 568101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:09:13+00:00 2026-05-13T13:09:13+00:00

I am using Java EE with Spring framework. I have been setting up a

  • 0

I am using Java EE with Spring framework. I have been setting up a test project (everything is working so far) and I currently have the following line in the controller to simply load up a view called index.jsp:

return new ModelAndView("index");

This is just a test project so I’m not worried about syntax or anything like that. I am simply wondering what is the best way to load up a certain view from within a controller in Spring? I am sure that hard-coding it like this is not best-practice and am just wondering what the proper way to do this is? Should the name be pulled from some config file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:09:13+00:00Added an answer on May 13, 2026 at 1:09 pm

    The Spring pattern at work here is the ViewResolver. Essentially, your controller returns the symbolic name of the view you want to forward to, and Spring resolves that symbolic name to an actual view. If you don’t configure it otherwise, then it’ll just stick .jsp on the end and use that – simplest case.

    However, this can get as complex as you want it to, including, as you suggest, using a configuration file to map the names to actual JSPs. As always with Spring, there are a dozen different ways to do this – see this part of the docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working Quartz framework in my grails project with lib called quartz-all-1.7.3.
I am very new to spring and java. I have been using mostly springsource.org
I'm a php programmer now doing a Java web project using Spring framework. I'm
I am using java spring framework to develop a Webapp. I have a situation
I've been working on a java spring project for a few months now. I
I've been working on a java web project. Currently this project doesnt use any
I'm developing Java Spring 3.1.0.RELEASE using Maven and have been running it on Jettry
I have a client and server communicating via Spring remoting (using Java Serialization) over
I am currently building an application using Tomcat, Spring and JAVA. I am using
I've been working on a project in Eclipse and everything's been going smooth except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.