I have 2 Visualforce Pages and each pages has an <apex:inputtext/>.What I want is passing The value of the first inputtext into another Visualforce inputtext . Please Help Me Experts.


  • 1
    Can you post the related code snippets ? Specially how you navigate from first page into the second page?
    – highfive
    Aug 11, 2015 at 8:47

2 Answers 2


PAGE 1 - if you see below page, we have an inputtext with a value which is bind to the controller. We have a button on this page, clicking on which you will be navigated to next page.

<apex:page controller="Controller1" sidebar="true" showHeader="true" >
    <apex:form >
        <apex:inputtext value="{!inputText1}"  />  
        <br />
        <apex:commandButton value="Send" action="{!GoToPage2}" reRender="result"/>

CONTROLLER 1 - this controller has inputText1 declared with get,set. It contains the method that passes this text in url appended in 'att' (assuming 'pagetwo' is name of your second page)

public class Controller1{
    public String inputText1 {get;set;}
    public Controller1(){
    public pageReference GoToPage2(){
        PageReference pf = new PageReference('/apex/pagetwo?att='+inputText1);
        return pf;

PAGE 2 - has inputText2 which is again bind with controller and value is displayed in VF page.

<apex:page controller="Controller2" sidebar="true" showHeader="true" >
    <apex:form >
        <apex:inputtext value="{!inputText2}"  />  
        <br />

CONTROLLER 2- if you observe this, all we are doing is getting the 'att' from URL in constructor and assigning to inputText2

public class Controller2{
    public String inputText2 {get;set;}
    public Controller2(){
        inputText2 = apexpages.currentpage().getparameters().get('att');

Thus you ll observe that inputText1 is passed from page1 to page2 and displayed there. This is pretty generic example that I can think of!


pass the value you enter in VF page 1 to VF page 2, using url. You need to set the value of input in url as parameter.

See the code :

public String valueofInputtext {get; set;}
public PageReference callPageVF2() {
PageReference pageRef = new PageReference('\apex\VFpage2?Inputvalue ='+valueofInputtext);
return acctPage;

In the controller of your Vfpage2 get the value as


or you can get the same value in your VF page direct by


This my help you out.


You must log in to answer this question.

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