Then when this page loads, it calls locationsExt.redirect()
redirect() looks like this:
public PageReference redirect() {
// jump to the prefered page, // default is provided for us by Prefs String prefUrl = Prefs.object_selected; PageReference p = new PageReference( prefUrl); p.setRedirect(true); return p; }
this redirect will allow you to visit one or the other of your pages, your code for redirect will have to read case priority and then specify one page or the other.
Then when this page loads, it calls locationsExt.redirect()
redirect() looks like this:
public PageReference redirect() {
// jump to the prefered page, // default is provided for us by Prefs String prefUrl = Prefs.object_selected; PageReference p = new PageReference( prefUrl); p.setRedirect(true); return p; }
this redirect will allow you to visit one or the other of your pages, your code for redirect will have to read case priority and then specify one page or the other.
Are there any restricts no what can be done with that redirect? I've done the apex page redirect in a method that also does some setting in other methods before going to the page reference. It's also nested in an If statement so if my requirements are not met, the page does load. I can get the method to call and work correctly when called from a commandbutton - but not when the page loads. Instead I receive an "Invalid root component None found in view /apex/s7statuswizard2?id= ..."
The error only occurs when the first if statement returns true and the method does the page reference. I've tried removing the if statement entirely and only having the page reference and I still get the invalid root error. This is on a sandbox that was refreshed 2/27/09
No, I submitted a case and it's been escalated up to the developer group. They were looking at it last night, but I don't have any updates from them yet.
One suggestion they made was to remove the action from the apex page component and replace with an actionSupport underneath the apex page component. No idea if that'll work yet though.
If I get resolution I'll try to post the results here
Not an uncommon request, here is one way.
you start with a simple page:
<apex:page sidebar="false"
action="{!redirect}" controller="LocationsExt" >
</apex:page>
Then when this page loads, it calls locationsExt.redirect()
redirect() looks like this:
public PageReference redirect() {
// jump to the prefered page,
// default is provided for us by Prefs
String prefUrl = Prefs.object_selected;
PageReference p = new PageReference( prefUrl);
p.setRedirect(true);
return p;
}
this redirect will allow you to visit one or the other of your pages, your code for redirect will have to read case priority and then specify one page or the other.
All Answers
Not an uncommon request, here is one way.
you start with a simple page:
<apex:page sidebar="false"
action="{!redirect}" controller="LocationsExt" >
</apex:page>
Then when this page loads, it calls locationsExt.redirect()
redirect() looks like this:
public PageReference redirect() {
// jump to the prefered page,
// default is provided for us by Prefs
String prefUrl = Prefs.object_selected;
PageReference p = new PageReference( prefUrl);
p.setRedirect(true);
return p;
}
this redirect will allow you to visit one or the other of your pages, your code for redirect will have to read case priority and then specify one page or the other.
Hey Ron,
Are there any restricts no what can be done with that redirect? I've done the apex page redirect in a method that also does some setting in other methods before going to the page reference. It's also nested in an If statement so if my requirements are not met, the page does load. I can get the method to call and work correctly when called from a commandbutton - but not when the page loads. Instead I receive an "Invalid root component None found in view /apex/s7statuswizard2?id= ..."
The error only occurs when the first if statement returns true and the method does the page reference. I've tried removing the if statement entirely and only having the page reference and I still get the invalid root error. This is on a sandbox that was refreshed 2/27/09
public PageReference Initialize() { if(getInterfaces().size() == 1 && getWebs().size() ==1) { List<cImps> WebImps = getWebs(); list<cImps> IfIMps = getInterfaces(); WebImps[0].wSelected = true; ifIMps[0].iPrimary = True; ifImps[0].iSelected = true; ID ParentImpID = this.controller.getRecord().id; PageReference S7StatusWizard2 = Page.S7StatusWizard2; S7StatusWizard2.getParameters().put('Id',ParentImpID); return S7StatusWizard2; } else { return null; } }
<apex:page standardcontroller="Parent_Implementation__c" extensions="S7_Status_Controller_Extension" action="{!Initialize}" >
No, I submitted a case and it's been escalated up to the developer group. They were looking at it last night, but I don't have any updates from them yet.
One suggestion they made was to remove the action from the apex page component and replace with an actionSupport underneath the apex page component. No idea if that'll work yet though.
If I get resolution I'll try to post the results here