Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Javascript Variable to POJO using DWR

 
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
 
Author
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?
 
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
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.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!