Home > Back-end >  How to use for springmvc controllers can do get the request source address, jump back to this addres
How to use for springmvc controllers can do get the request source address, jump back to this addres

Time:09-22

Today in the controller that written by


The String url=request. GetHeader (" REFERER ");
String turl=url. The substring (url. LastIndexOf (shop) + shop. Length ());
Return turl;

But it has a big problem is that the execution of a controller and a jump after view the address bar becomes the controller's address instead of view;
So the getHeader (" REFERER ") is the address of a controller, this method will not be able to return to I want to address;
How to do it shout for help

CodePudding user response:

Originally the homepage address bar is http://localhost:8081/springmvc/index.jsp;
But perform a controller such as call the login. The action after the jump back to the home page
Home page's address bar becomes http://localhost:8081/springmvc/login.action
So with the request. GetHeader (" REFERER "); Is obtained by the login. The action of address
It's not the correct what to do

CodePudding user response:

reference 1st floor q54244125 response:
not read

Simple to understand is the title

CodePudding user response:

reference 1st floor q54244125 response:
not read

CodePudding user response:

CodePudding user response:

The controller layer returns a modelview object, will return to the page of your path in the modelview object

CodePudding user response:

Actually can use ajax requests in the page, and then jump back in the home page in success, so that the controller, there is no need to do related to jump in

CodePudding user response:

refer to the second floor fengzhisuoxing response:
original address bar is the http://localhost:8081/springmvc/index.jsp; home page
But perform a controller such as call the login. The action after the jump back to the home page
Home page's address bar becomes http://localhost:8081/springmvc/login.action
So with the request. GetHeader (" REFERER "); Is obtained by the login. The action of address
It's not right to do yet


I also took, such a simple question if you want to so long, you add a parameter to your Controller: fromUrl, your manual transmission, then execute after the jump fromUrl not line?

CodePudding user response:

The building Lord have a solution?
  • Related