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 9152329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:00:58+00:00 2026-06-17T12:00:58+00:00

I am using Spring mvc and I have this problem: Every method in my

  • 0

I am using Spring mvc and I have this problem:

Every method in my controller returns a name of a jsp, and as for presentation – all good. The problem is with links (hrefs). The window’s link does not change and the relative links gets me to unwanted places.

For example (not real):

I have a view which I can access by:/test1/{id}
and an update view which I access by /test1/{id}/update

The post method, saves, and return the first view (getting you back to the viewing screen).
The presentation is OK and I can see the updated data. But the window url was not changes and if I try to update again, I am sent to this location: /test1/{id}/update/update.

How can I solve this?

  • 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-06-17T12:00:59+00:00Added an answer on June 17, 2026 at 12:00 pm

    Short answer: use redirects!

    You MUST use redirects while doing something persistant. I guess you are modifying data when POSTing to those url. So you absolutely need to use redirects. This resolves the problem, when user refreshes the page after making an update. Have you ever noticed browser’s warnings about resending the data?

    Sample code:

    @RequestMapping("/test1/{id}/update")
    public ModelAndView update(@PathVariable("id") String id){
        // make an update
        return new ModelAndView("redirect:/test1/" + id);
    }
    

    This will send 301 or 302 HTTP status to the user. And the browser will imeddiately follow to the redirect url. Note that you should use not a view name, but url.

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

Sidebar

Related Questions

Using Spring MVC, I have this Controller class: @Controller public class LoginController { @Autowired
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value
assume you have something like this in normal servlet without using spring mvc: if(username
I'm trying to make this 2-player web game application using Spring MVC. I have
I am developing my application using spring-web-mvc... Now at my Controller it returns like
has any one using Spring MVC with Jquery! i have got a strange problem
Using latest Spring-MVC (3.1.2.RELEASE) I have a pagable REST method something like: @RequestMapping(value =
I am using jsp + spring mvc, and on jsp page I have some
I have problem using annotated validation in spring 3 mvc. I´m not sure if
I am using spring mvc in my application,when i created user i have to

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.