Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript Variable to POJO using DWR

 
ragha sid
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do I send a javascript variable from my client side to the server side and use it as a java bean on the server side using DWR?

Rahgav
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You call Java methods in a way that looks just like Java--DWR creates JavaScript versions.

What specifically are you having problems with?
 
Raghav Sidhanti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

Thank you. DWR works seamlessly when I send a java bean from my server side to my client side. But when I tried it the other way around it doesn't covert my javascript variable back to the java bean it originally was.

for example. I have a list of company beans that I am sending from my server side to the client side.


In my DWR class, I have two methods namely:

At the client side I call the getListOfCompanies() method (dwr style) and it will return the list as an array which I will loop through to get my companies as javascript variables.

Now, at the client side I perform some changes to these companies and add them back to an array in order to send them back to server side. However, when I call the saveListOfCompanies(List) I getting a list of java.lang.Strings on the server side and not a list of Company bean.

My question is, how do I get back my Company beans and not a String?

Hope this makes sense.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without any code or configs I don't know how to help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic