Tuesday, December 29, 2009

How to set Book default page in runtime?

To make a page of book as default in runtime set that PageBackingcontext as active --setActive().

See the code below ,

PageBackingContext pbcHome = null;

PageBackingContext pbcHome1 = null;
PageBackingContext pbcHome2 = null;
PageBackingContext pbcHome3 = null;

BookBackingContext bbc = BookBackingContext.getBookBackingContext(request);
pbcHome = bbc.getPageBackingContextByDefinitionLabel("intranetvz_portal_vzcorp_page");
pbcHome1 = bbc.getPageBackingContextByDefinitionLabel("intranetvz_portal_vso_page");
pbcHome2 = bbc.getPageBackingContextByDefinitionLabel("intranetvz_portal_telebusiness_page");
pbcHome3 = bbc.getPageBackingContextByDefinitionLabel("intranetvz_portal_vzwireless_page");

pbcHome.setActive(false);
pbcHome1.setActive(true); -- Making that page as active
pbcHome2.setActive(false);
pbcHome3.setActive(false);

Thanks,
Venkata Sarvabatla

2 comments:

  1. Can u please tell me where exactly to do this logic,is it in the lifecycle methods of the backing file

    ReplyDelete
  2. Hi thanks for the post. I am using weblogic portal 10.2. I have a login page that calls the weblogic portal URL upon success. I need to redirect to a different portal page depending on an input param. I tried using _nfpb=true in the portal URL so that the control goes into handlePostbackData() of the backing file where i can set the appropriate default page as suggested in the post. Not sure why but the control does not go into the handlePostbackData() method at all. ANy suggestion how to handle the redirect ?
    Thanks
    GT

    ReplyDelete