Announcement Announcement Module
Collapse
No announcement yet.
DWR Custom Objects not being read correctly Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DWR Custom Objects not being read correctly

    Hello there,

    I am using DWR to convert an array of objects (called Rhasset.java) from JavaScript to the back-end. Simple arrays of Strings work, the individual Rhasset object also works but when I send an array of Rhasset objects than the element data looks as follows:

    [{name:reference:c0-e2, value:reference:c0-e3}]

    The 'name' and 'value' are the actual keys for the objects entries but the values are not readable.

    Here is my code:

    JavaScript:

    Code:
    var testArray = [{ name : 'TestName', value: 'TestValue'}];
    rhassetServices.invokeMessage(testArray);
    DWR.XML:

    Code:
    <convert converter="bean" match="com.qas.newmedia.internet.rhasset.model.Rhasset" />
    Java Controller:

    Code:
    public List<Rhasset> invokeMessage(List<Rhasset> list) {	
    	return list;
        }
    Java Object:

    Code:
    public class Rhasset {
        
        public String name;
        public String value;
        
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    As you can see this is pretty straightforward stuff. In fact I can remove the Rhasset stuff and just read back arrays of string objects and still get the same issue.

    I have tried messing around with signatures and converters and a number of other things but have not been able to get anywhere - and as far as I know this set-up should be supported as standard.

    Can someone suggest as to what I might be doing wrong or suggest any other avenues to investigate?

    Many thanks in advance,

    Greg

  • #2
    Any pointers would be greatly appreciated as I am now going down the route of using Ajax with JSON objects.

    But I would much prefer to use DWR.

    Many thanks in advance,

    Greg

    Comment


    • #3
      Hello Greg

      With the best intentions try to go with jQuery, it has a great Ajax support too.

      Comment


      • #4
        Thanks for your reply. Yes, I have resorted to using jQuery with Ajax and it does everything I need it to do. Would be nice to have used DWR though, and also to know what I was doing wrong.

        Thanks again, G.

        Comment

        Working...
        X