function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
anjisalesforce@gmail.comanjisalesforce@gmail.com 

How to send the parameters one page to another page using Apex class?

Hi all,

 

How to send the parameters one page to another page using Apex class?

 

 

Thank u for u r help....


kiranmutturukiranmutturu

through query string params or through properties

anjisalesforce@gmail.comanjisalesforce@gmail.com

Can you please give me one example?.......

kiranmutturukiranmutturu

can u use the same controller for the two pages?

kiranmutturukiranmutturu

through query string

 

page1:

  consider u r clicking on a button or link then click redirects to second page then 

u can set the url for the secong page as https://c.cs6.visual.force.com/apex/secondpage?var1=value1&var2=value2.. var1 and var2 are queryb string params and u can access them in the second page using

Apexpages.currentPage().getParameters().get('var1')......like this.. 

anjisalesforce@gmail.comanjisalesforce@gmail.com

Sorry, 

 

i am not getting the code correctly.

 

here is my code:

 

1st page:

<apex:page controller="passvalues">
<apex:form >
<H1> Passing Values from one page to another page</H1>
<br />
Enter First Value : <apex:inputText value="{!value1}"/>
Enater Second Value : <apex:inputText value="{!value2}"/>
<apex:commandButton value="Go to Second Page" action="{!Nagivatepage}" />
</apex:form>
</apex:page>

 

 

1st class:

public with sharing class passvalues {

public PageReference Nagivatepage() {
obj=new PageReference('/apex/secondpage?var1=value1&var2=value2');
return null;
}
public PageReference obj;

public string value1{get;set;}
public string value2{get;set;}
}

 

 

2nd page:

 

<apex:page controller="class2">
<apex:outputLabel value="{!var1}"></apex:outputLabel>
<apex:outputLabel value="{!var2}"></apex:outputLabel>
</apex:page>

 

2nd class:

 

public with sharing class class2 {

 

public string var1{get;set;}

public string var2{get;set;}

Apexpages.currentPage().getParameters().get('var1');
Apexpages.currentPage().getParameters().get('var2');
}

 

 

but this code is not working properly.....

 

please clarify that one its very urgent....