• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts with Javascript problem

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a long one, get comfortable.....

I have a Struts 1.1 application, one view has 2 JSP's that do the following:
  • Parent JSP (hereafter JSP#1) has a nested iFrame on the top half of the screen that contains child JSP (hereafter JSP#2).
  • JSP#2 does nothing but produce a result set of data in a scrollable <div>, which auto refreshes itself every 15 seconds using a Javascript setTimeout. The refresh submits to an action servlet that updates the forms result set Collection.
  • Each record in the result set on child JSP#2 has an 'EDIT' link.
  • JSP#1 contains all the edit controls, so when a user clicks the 'EDIT' link beside a record on nested JSP#2, we submit to an action servlet that reloads the page with the record's data loaded into the edit fields on parent JSP#1.

  • The nested iFrame was required so when JSP#2 auto-refreshes, it would not interrupt users editing data in the bottom part of parent JSP#1.

    Works like a charm (or at least as a webapp is expected to) in my opinion ... However my users do not agree.

    My main Problem: When the nested JSP#2 refreshes, the content of the iFrame flickers -- which seems to be a REALLY big annoyance.
    IE page refresh is noticeably worse than on FireFox/Navigator but "corporate" policy demands IE so changing browsers is out. This problem must be fixed -- they want a "flickerless" data refresh (keeping in mind the database is halfway across the country from the users).

    What I have planned to attempt to please the masses:
  • Changing the iFrame containing JSP#2 to a hidden form object so refreshes are in the background. Stripped all formatting and the 'EDIT' link.
  • Cloned the scrollable <div> result set onto JSP#1 (including EDIT link), so the list and edit fields are no longer on different pages.
  • I need to compare the hidden result set on JSP#2 after every refresh against the display result set on JSP#1, and if changes have occurred update the visible list (via Javascript, to avoid submitting the form and flicker).

  • I have modified the nested iFrame to be hidden and added a visible result set to the parent JSP#1. That much is OK, auto-refreshes are not visible, but are working. However, I am at a loss as to how to clone the hidden auto-updating list to the visible one with javascript.

    - The result set lists are defined as java.util.Collection
    - Each element in these Collections are DynaActionForms

    This is my form bean definition from my struts-cfg.xml

    .. and here is how the result set is set up to loop through this Collection of DynaActionForms to produce the result set:

    Can Javascript copy my full Collections over from child to parent? Is there a way for Javascript to handle struts objects (like that element DynaActionForm) and loop through them to copy property by property? This result list is seldom larger than 15 records, so even copying in the latter way would be acceptable.

    After each auto-update, I need to be able to compare the Collection from the updated JSP#2 and visible JSP#1. If changes are detected, I need to be able to either update the changes, or the full Collection to the visible list using Javascript as submitting the task to a servlet is producing this flicker that has been deemed "unacceptable" :roll:

    Any help or tips would be appreciated.

    [ July 25, 2006: Message edited by: Jitwad ]
    [ July 25, 2006: Message edited by: Jitwad ]
    Ranch Hand
    Posts: 4864
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    We're glad you dropped by the Java Ranch. There aren't many rules here, but we do ask that you let us know who you are by giving us your actual first and last names. Please make sure the "publicly displayed name" in your profile meets the JavaRanch naming policy.
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sorry about that, I didn't read the rules before I signed up (shameful, I know )

    As for my problem.... the user demands are ever increasing, so it looks like I will have to rebuild the user UI with a richer client interface.

    So likely I will be re-developing this particular screen in openLaszlo to give them everything they want :roll:

    Thanks anyways.

    (...I will update my user profile shortly)
      Bookmark Topic Watch Topic
    • New Topic