• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use Spring / DWR Revers Ajax functionality to display dynamic changes to table data

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my current Spring/JSF project I need integrate a method to push server side updates (Preferably as they happen) to the web based GUI to be displayed to the clients.

So to get started with things, I am working on this small application to get a feel of how DWR works.Basically, I've developed two variations to implement the server side push.

In the first approach, when the "find button" is pressed the back end updates are properly displayed.This makes a calls the findInstrumentSymbols() method in the InstrumentManager and returns the output as a List Objects through DWR.

In the second approach I attempted to implement the reverse ajax approach suggested in the DWR webs site.(http://directwebremoting.org/dwr-demo/reverseajax/peopleTable.html)

How can make this functionality available as the default functionality every time a page loads without having to specifically activate it through a button?

In this implementation I was unable to return the output as a List Objects through DWR as in the first approach and had to be sent as a string array.I see that the new results are not populated properly as in the first approach and it tends to looses the new data when the "Disable button" is pressed.How can this required reverse server push functionality be properly achieved using DWR?

I have listed the code fragments below.I Would really appreciate any pointers on getting the revers Ajax functionality to operational.

I have used polling as as described in earlier DWR releases.What method would be most ideal to implement reverse Ajax functionality if switching to DWR3 is the way forward ?

Web.xml



DWR.XML



application-context.xml



Instrument Class



InstrumentManager Class



InstrumentManagerImpl Class


updateMMStatus.xhtml

 
T.G.A Mendis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted out one part of the problem but I have had no luck withe the passing a java List<Instrument> using server side push as yet.

I have been studying the peopleTable demo application (http://directwebremoting.org/dwr-demo/reverseajax/peopleTable.html) and similar applications based on the web to come up with a solution for my problem. Most of these applications pass String or String arrays.

>>>This makes a calls the findInstrumentSymbols() method in the InstrumentManager and returns the output as a Object through DWR.
One thing I noticed in DWR was that when a DWR java script is called linked to a GUI operation such as Onclick (E.g.find button), Object or collection type data can be passed smoothly.I believe a JSON object is returned on this instance.

findInstuments methods JSON output as displayed in the program and can be easily integrated into the web page.
https://picasaweb.google.com/111228036846988065850/DWRFindInstumentsMethod#5697056122078739810 ">https://picasaweb.google.com/111228036846988065850/DWRFindInstumentsMethod#5697056122078739810


>>>But when you try to pass data to the webpage using server push operation,I was unable to return the output as before through DWR as in the first approach.It had to be sent as a string array.(based on the information I came across)

I based the server Push sample code on a variation of the peopleTable demo.It seems DWR provides little facility to send Collection or Objects to the GUI, though it is easily available when linked to a user operation where JSON objects are passed.(It seems to offers support for String /String arrays and String based collections or that is what I gathered :|)

The related code sample related to this description is listed below.(for the full code refer the original post)



When you try to alter this functionality to support other data types such List<Instrument> I couldn't find a Clean method as in the first instance where a Json object was passed - which was effortless.(I hope i haven't missed out something obvious :| )

Is there a better method that could be devised to transfer objects when using server push using this method ? (Resorting to String conversion seemed to be the method suggested in most of the web examples.)

Can data be exchanged as JSON Objects when server side push is performed without a GUI trigger to meet the same requirements?
Is so what additional configuration changes and Updates would be required?

If a JSON based data transfer is possible for server side Push, could you please give some heads up on some document, site or sample code that may be of any assistance.Any such lead would be much appreciated for I have found nothing concrete on this topic

Thank You In Advance
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic