Use Apex class to do this action: When open page 'RedirectPage', move to 'TargetPage' directly.
RedirectPage is name of Visualforce page
Code:
RedirectCtrl is name of Apex class that use to control 'RedirectPage'
Code:
TargetPage is name of Visualforce page that 'RedirectPage' will redirect to.
Code:
That is all.
RedirectPage is name of Visualforce page
Code:
<apex:page controller="RedirectCtrl" action="{!doRedirect}">
Redirect to TargetPage directly...
</apex:page>
RedirectCtrl is name of Apex class that use to control 'RedirectPage'
Code:
public class RedirectCtrl {
// create redirect function
public PageReference doRedirect() {
// set target page
PageReference pageRef = Page.TargetPage;
// set a parameter to url, format 'site.com?PARAME_TYPE=PARAME_TYPE_STR'
pageref.getParameters().put('PARAME_TYPE','PARAME_TYPE_STR');
// do page redirect
pageRef.setRedirect(true);
// begin to redirect
return pageRef;
}
}
TargetPage is name of Visualforce page that 'RedirectPage' will redirect to.
Code:
<apex:page>
This is target page of redirect action.
</apex:page>
That is all.
No comments:
Post a Comment