How to avoid loading data onrender (if there is no action) - Websphere

This is a discussion on How to avoid loading data onrender (if there is no action) - Websphere ; Hi, I have a portlet on page which loads data on render. That is the user does'nt have to perform any action on screen to load the data. Since I have no other option I had to implement the loading ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: How to avoid loading data onrender (if there is no action)

  1. How to avoid loading data onrender (if there is no action)

    Hi, I have a portlet on page which loads data on render. That is the user does'nt have to perform any action on screen to load the data. Since I have no other option I had to implement the loading of data (connecting to backend , fetching the data etc) in the render method. Is there a better approach to this ?

    Also, this page is shown as soon as the user is logged in. Hence, it is at times taking ages for the user to login as I think the portal just keeps him in the login page until the home page (with the above portlet) is ready to render. Is there anyway I can let the user first login and automatically invoke the loading/rendering of page once the user is inside the page [ Like you do things onLoad in the normal jsp/html world or some other ajax trick]

    Thanks

  2. Re: How to avoid loading data onrender (if there is no action)

    Once the page is sent and rendered, that is the end of your control over the page unless you use AJAX techniques.

    Another more primitive solution that some people use is to use a redirect. Once the user logs in, send them a page with a message telling them that their login was successful. You can then use a script to redirect them to the page that takes longer to render.

    On another note, if your login page is taking a noticeably long time to respond, you may want to refactor your backend code. Specifically, any database queries that you may be using. Maybe querying a predefined view to obtain your data?

  3. Re: How to avoid loading data onrender (if there is no action)

    in my opnion, you can make use of expiration cache of JSR 168 portlet.

    this requires, defining an entry in your portlet.xml and provide time ( in seconds )
    100

    if this entry is set for a portlet, that portlet data is cahced for provided time period until and unless any action is performed on that portlet.

    means, once any action is performed on that portlet, then container discards the cached data and DB hit (if any) will occur.

    hope that helps...

    **
    *http://ExtremePortal.blogspot.com*

+ Reply to Thread