I'm trying to pass the value from a public page variable to another page (both using same controller) without using parameters.
public String variable {get;set;}
The point is on my first page the variable retrieves the value I want but on the second one I have this statement that keeps on doing:
if(String.isEmpty(variable)){
variable = 'not passing';
}
So why is this happening and what do I need to do to achieve that variable keeps the same value that retrieves on first page?
EDIT
public class DemoClass(){
public String variable {get;set;}
public DemoClass(){
variable = variable == null ? ApexPages.currentPage().getParameters().get('variable'):variable;
}
public PageReference methodCallSecondPage(){
PageReference ref = new PageReference('/path/to/second/page');
ref.setRedirect(false);
return ref;
}
}