0

I have a output field like

<apex:outputField value="{!objAccount.AccountNumber} "/>

and i want the value of this field(whisch is 1234Ex) to be passed to another page so that i can use it there.

Could you please help i could pass the value and how i need to use it in apex code?

Please help.Its urgent

3
  • Use same Controller for both pages.
    – snehakem
    May 28, 2015 at 9:00
  • You've shared very little information and no code, so people are going to struggle to help you. Try this similar question.
    – Rob
    May 28, 2015 at 9:02
  • <apex:outputField value="{!objAccount.AccountNumber} "/> I want to pas the value of this field to new page.. May 28, 2015 at 9:44

2 Answers 2

2

If the new page is a Visualforce page you can explicitly pass a parameter in the new page URL:

<apex:outputLink
        value="{!URLFOR($Page.SecondPage, null, [an=objAccount.AccountNumber])}"
        >Go to Second Page</apex:outputLink>

that the second page can then pick up:

public with sharing SecondPageController {

    private String accountNumber;

    public SecondPageController() {
        accountNumber = ApexPages.currentPage().getParameters().get('an');
    }

    // Other code can reference accountNumber
}

This pattern avoids an unnecessary round trip to the server.

0

if you want pass a value from visualforce to another visualforce you can send the new value as Parameter URL.

visualforce

<apex:outputText value="acc.Name"/>
<apex:commandLink action="{!gotoNewPage}/>

Controller

public Account acc {get;set;}

public PageReference gotoNewPage(){
    PageReference newPage = Page.NewPage;
    newPage.getParameters.put('accName',acc.Name);
    return newPage;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .