Activity Forums Salesforce® Discussions What is PageReference in Salesforce Apex?

  • Aman

    Member
    September 22, 2018 at 11:26 am

    What is PageReference in Salesforce Apex?

  • Aman

    Member
    September 22, 2018 at 11:26 am

    A Page Reference is a reference to an instantiation of a page. Among different characteristics, Page References comprise of a URL and an arrangement of inquiry parameter names and qualities

  • Saddam

    Member
    October 21, 2019 at 12:59 pm

    Hi,

    A PageReference is a reference to an instantiation of a page. Among other attributes, PageReferences consist of a URL and a set of query parameter names and values.

    Use a PageReference object:
    · To view or set query string parameters and values for a page
    ·  To navigate the user to a different page as the result of an action method

    Methods
    PageReference methods are all called by and operate on a particular instance of a PageReference

    The table below describes the instance methods for PageReference.
    getAnchor()
    Returns the name of the anchor referenced in the page’s URL. That is, the part of the URL after the hashtag (#).
    getContent()
    Returns the output of the page, as displayed to a user in a Web browser.
    getContentAsPDF()
    Returns the page as a PDF, regardless of the <apex:page> component's renderAs attribute.
    getCookies()
    Returns a map of cookie names and cookie objects, where the key is a String of the cookie name and the value contains the list of cookie objects with that name.
    getHeaders()
    Returns a map of the request headers, where the key string contains the name of the header, and the value string contains the value of the header.
    getParameters()
    Returns a map of the query string parameters that are included in the page URL. The key string contains the name of the parameter, while the value string contains the value of the parameter.
    getRedirect()
    Returns the current value of the PageReference object's redirect attribute.
    getUrl()
    Returns the relative URL associated with the PageReference when it was originally defined, including any query string parameters and anchors.
    setAnchor(String)
    Sets the URL’s anchor reference to the specified string.
    setCookies(Cookie[])
    Creates a list of cookie objects. Used in conjunction with the Cookie class.
    setRedirect(Boolean)
    Sets the value of the PageReference object's redirect attribute. If set to true, a redirect is performed through a client side redirect.

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos