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