• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Is there a more elegant way to employ DWR ?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
Here is a snippet from my shopping cart code :

The shopping cart logic is usually called inside the action logic:

ShoppingCart is POJO, there is no Servlet classes dependencies.
Now I want to call the shopping cart methods using the DWR.
Here is a part of the required JavaScript:

My first obstacle was the book is a session based object, I have no way to access it at the JavaScript level.
So, I serialized the book's state into hidden input fields in the JSP and then I used :
DWRUtil.getValues(book);
But is there a more elegant way ?
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not exactly what you are asking since you're using POJOs, but DWR calls do have access to session e.g., using WebContextFactory.get().getSession().

DWR documentation

You definitely have to make some architectural decisions if you're going to add DWR to your current system. To keep your POJOs you could make the DWR call to a class that pulls the data out of session and calls the POJO.
[ April 21, 2007: Message edited by: Carol Enderlin ]
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So employing DWR is not a so transparent process ?
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
?
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since it requires some architectural decisions, as you said.
 
brevity is the soul of wit - shakepeare. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic