Topic
3 replies Latest Post - ‏2012-12-05T22:36:11Z by afarris7
afarris7
afarris7
61 Posts
ACCEPTED ANSWER

Pinned topic Post-Action Behavior stand-alone

‏2012-12-04T00:43:48Z |
Hello,

I am trying to create a custom print preview page. I have everything in place datapage, formatting, etc. This app is running as a portlet. The issue - when I open a new page (_blank) via a button it caches the print preview page as the current page. If I refresh the original page, it now becomes a print preview page. So I am playing with all the setCurrent page render request/action request etc.

I do see the Post-Action Behavior option in the button builder - "Show action results "stand-alone": display no containing pages". This seems perfect for me, it doesn't cache the current page in the portal.

However when I use this option it strips away all the html, head, title tags. None of my css takes since the page is malformed. Is there some way I can have "stand-alone" but still use a portal theme?

Thanks
Updated on 2012-12-05T22:36:11Z at 2012-12-05T22:36:11Z by afarris7
  • mburati
    mburati
    2391 Posts
    ACCEPTED ANSWER

    Re: Post-Action Behavior stand-alone

    ‏2012-12-05T20:46:45Z  in response to afarris7
    Because a JSR portal and portlet container can call render multiple (many) times for each action called on that portlet, WEF keeps track of the "current" portlet page for each portlet so it can re-render it each time the portal asks it to do so. That's why you're seeing it render the last page your portlet rendered when you refresh the portal page.

    There are a couple of ways I can think of to get your portlet to stay at or go back to, when you do your one-off popup page. I have not tried either of these (at least not recently) myself so I don't have exact instructions, just info that may help you get where you want to go:

    1) Generate the URL that generates the Popup programmatically via the WEF URLMapper API. Eg, ask webAppAccess for a URLMapper, call setKeepCurrentPage(true) on that URLMapper, generate the URL and save it with the button or link you need to use it with, call setKeepCurrentPage(false) on that URLMapper (so that other non-popup URLs are generated correctly). That mechanism is used by the Dojo Form Dialog builder to generate a URL to pop up the Dojo Dialog page from the portlet without changing the portlet's concept of its current portlet page.

    2) A coworker suggested trying an OnRequestComplete handler that checks to see if it's in a render request and if so gets the current page (webAppAccess.getCurrentPage() ) and if it's the popup page then call webAppAccess.resetCurrentPage( ... ) passing the page that you want to be the current portlet page.

    I hope that info helps,
    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: Post-Action Behavior stand-alone

      ‏2012-12-05T21:11:49Z  in response to mburati
      We've used method 2 for a similar requirement, and it works well.

      --Sam
      The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • afarris7
      afarris7
      61 Posts
      ACCEPTED ANSWER

      Re: Post-Action Behavior stand-alone

      ‏2012-12-05T22:36:11Z  in response to mburati
      Generate the URL that generates the Popup programmatically via the WEF URLMapper API. Eg, ask webAppAccess for a URLMapper, call setKeepCurrentPage(true) on that URLMapper, generate the URL and save it with the button or link you need to use it with, call setKeepCurrentPage(false) on that URLMapper (so that other non-popup URLs are generated correctly)

      Is this what you are talking about? I have included my PopUp test portlet but my other non-popup window still goes to page2 if I refresh.

      String url = null;

      URLMapper mapper = webAppAccess.getURLMapper();
      mapper.setKeepCurrentPage(true);
      String currentModelName = webAppAccess.getModelName();
      url = mapper.getURL(currentModelName, "page2");
      mapper.setKeepCurrentPage(false);

      return url;