+ Start a Discussion
RamboRambo 

VF Redirection Help Reqd

Hi All,

           I currently pass a variable value in my url when redirecting from VF Page 1 to VF Page 2. And i am performing some functionalities with that value. I wanted to know whether can we hide the values passed in the url similiar to what we can do in java???

 

My url is like dis :

www.google.com?id=xxxx&abc=yyyyy

 

I wanted to have dat abc value in the url but the visibility of my url should be like this:

www. google.com?id=xxx

 

Help needed in this...

 

 

 

goabhigogoabhigo

Which edition you are using?

If you can write controller then I think this can help you:

While redirecting to other page store the actual url(the URL which you don't want to display) in string(in controller using setter method). Note you have to use same controller for both the pages. Use that string for your further processing.

RamboRambo

The VF pages have different controllers.......So how do i do it in this situation??

Bhawani SharmaBhawani Sharma

On your second page you can use 2 different controllers like

controller="Controller1,Controller2"

RamboRambo

I guess ur suggesting to add it in the extensions or wat????

Bhawani SharmaBhawani Sharma

Yes, I mean whatever you have class attribute.

extensions="class1,class2"

RamboRambo

Any suggestions apart from using the extensions or using same controller???

Bhawani SharmaBhawani Sharma

You can store the data what you wanted to hide in URL in database and can pass that record id in URL. On the other page get the store dvalue from the database through the recordId param.

 

like:

1st Page:

CustomObject__c obj = new CustomObject__c(Name = 'ABCD');

insert obj;

 

now create the pagereference like this

'/apex/TestPage?recordId=' + obj.Id;

 

On the TestPage controller's constructor , fetch the value from the CustomObject__c using "recordId" request parameter.

String value = [Select Name from CustomObject__c where Id =: PAexPages.currentPage().getParameters().get('recordId')][0].Name;

goabhigogoabhigo

Nice one Bhawani. Didn't check it though, but sounds good.