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

  • SEARCH
  • Home
  • 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 7668347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:20:25+00:00 2026-05-31T15:20:25+00:00

This might be an obvious question. But am not able to figure it out

  • 0

This might be an obvious question. But am not able to figure it out so far.

In my Spring application, I make a GET request to the following url

http://www.example.com/firstpage

This request goes to the front controller where I have a request mapping as below:

@RequestMapping(value = "/firstpage")
public String handlerMethod(HttpServletRequest request, HttpSession session)
        throws CustomException {
        ...
        return "secondpage";
}

This “secondpage” corresponds to secondpage.jsp and its contents are correctly displayed.
But the problem is the browser URL still displays

http://www.example.com/firstpage

Why is this happening? Any suggestions as to how to make the browser URL change?
Also does Spring have any default support for encoding URL ?

  • 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-31T15:20:27+00:00Added an answer on May 31, 2026 at 3:20 pm

    One of the beauties of Spring MVC is that the view is totally separate from the controller. So your controller maps to the URL path “/firstpage” and in response can render any view. It may be a JSP, JSON, PDF, whatever type of view. Your view resolver configuration determines which view is used.

    In your case, you are returning “secondpage” which simply tells spring to look for the view named secondpage, in accordance with your view resolver configuration which probably looks in WEB-INF for secondpage.jsp or something like that. It’s still just a view.

    If you would like it to do something else, you can return “redirect:secondpage” which will tell the browser to actually redirect to “/secondpage” which I believe will change the url in the address bar, but it will also want to go to a controller mapped to “/secondpage” or will need a view mapped without a controller.

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

Sidebar

Related Questions

This might sound like an obvious question but I can't seem to find the
This might be an obvious question. But I haven't encountered this scenario before. In
This might seam like a strange question but.... public string MyProperty { get {
This seems to me pretty obvious, There is not but I might be leaving
This might be an obvious question but I'm having trouble googling for a best
The question is extremely easy, but the solution might not. Let's say this is
This might not appear like a programming question, but inherently deals with code. I
I'm new to JQuery so this question might be an obvious one, but I
I know this might be obvious, but bear with me my generic programming background
This might be basic question but how do I create a list of lists

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.