Get the URL of the last request from requests

Source: Internet
Author: User


Turn from: http://www.iteye.com/topic/100178


In the HTTP request object, you can take the HTTP header header, one of which is "Referer", through which we can know the URL of the last request, which is quite useful in some situations.
As in a list page, there is usually a delete link that deletes one of the data in the list, and if you want the deletion to succeed and then return to the list page, you can do the following:


String Returl = Request.getheader ("Referer");  
if (Returl!= null) {   
    response.sendredirect (returl);   
}   


It's just so simple, it's OK.
For add and edit operations, you can do the same, just a little workaround, to pass a referer from the previous page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.