Forum Stats

  • 3,839,777 Users
  • 2,262,536 Discussions
  • 7,901,054 Comments

Discussions

Create pageflow variable

719282
719282 Member Posts: 37
edited Oct 8, 2009 6:42PM in WebLogic Portal
How do I create a pageflow variable that is accesable in the JSP? When I open a JPS page in workshop I have a page flow variables overview (Design Palette, data) but no pageflow variables show up at this location. Anyone an idea how to create a pageflow variable to show op here?

Thanks.

--- edit ----
I use Portal Worskhop 10.2

Edited by: HeckerBob on 07-Oct-2009 03:16
Tagged:

Answers

  • 655221
    655221 Member Posts: 116
    Hey HeckerBob,
    It has been a while but I used to do some web app development with pageflow and my guess is that you need a public getter and setter in your pageflow the follow the java bean naming conventions for your property:

    private String myProperty;

    public String getMyProperty()
    {
    return myProperty;
    }

    public void setMyProperty(String value)
    {
    myProperty = value;
    }

    There are tools to add a bean to the pageflow automatically but I don't remember them... if this is the only one you are going to do then try whipping it out by hand... if you are going to do this a lot then look for the tools in the pageflow editor to add a bean to the controller.

    If that doesn't work then let me know and I'll try it out myself to see if I can give you a better answer. If you can't find the tool for adding a bean to the controller I can try to look for that too.
  • 672451
    672451 Member Posts: 1,016
    a word of advice , dont use pageflow variables(in a portlet) unless you really need them . These are effectively session scoped.
    The previous poster is correct for your problem and access them as ${pageFlow.var}
  • 655221
    655221 Member Posts: 116
    Good point about pageflow instance variables ending up in the session. I remember now that we purposefully limited the use of pageflow instance variables in my last project for this very reason... to avoid blowing up the size of the session.
  • user9503787
    user9503787 Member Posts: 162
    For my project, most the jpf do the database work and save the data result in jpf variable, the jsp page uses it. In this case the next user visit in the same sesison the jpf won't do the database work again? I am trying to weigh the session usage or the database lookup (If I don't use the jpf variable but put the result in request, I am pretty sure every time we need do database work).
  • 672451
    672451 Member Posts: 1,016
    In this case the next user visit in the same sesison the jpf won't do the database work again
    Correct.
    If I don't use the jpf variable but put the result in request
    Correct (Assuming the request attribute persistence on the portlet is none and not session, you should always have this as none)
    But those aren't the only options available to you correct?.
    The problems with sessions are
    a. if say 100Kb is stored per user and you have 100MB available to your app, what is the max number of users with an active session you can have (contrast this with request where you only need bother about concurrent usage, for session you have to bother about users with an active session).
    What happens if there are more users on the site? your site keeps getting slower with increased memory consumption (due to more frequent GC's)
    b. Suppose you want failover, a managed server goes down , then whats the hit to replicate the user's session
    c. Suppose you have multiple pages in your portlet. You rely on the session (or pageflow having certain data). What happens when the user bookmarks a page?
    d. What happens if the data you loaded changed. How does the user get the latest data?

    For all data that can be refetched you should use Cache, never session. The session is only meant for data that cannot be obtained in any other way (so a list from db should be cached , but user selections that havent yet been persisted may be saved in session , if you cannot implement it any other way e.g. hidden variables). In this case your pageflow will ask some service to get data (usually decorated by a cache) , if the cache has the data it will return it to you, else it will fetch, the pageflow will set it in the request. The next request, the cache already has the data so there is no db hit.
    You can size the cache (so that you will never exceed memory limitations) , You can expire items, You can reload in the background, you can flush the cache etc etc...
This discussion has been closed.