« Return to Thread: RE: signatures help

Re: signatures help

by David Marginian-2 :: Rate this Message:

Reply to Author | View in Thread

Sorry, I missed that.  You still do not need signatures.  What you are
sending to your java method is fine.

It looks to me that your Java code and logic is at fault.  
1) Add a breakpoint to your Java method and debug it.
2) Write a test case and verify that the method performs as expected.

Original Message:
-----------------
From: tyju tiui jckdnk111@...
Date: Wed, 23 Apr 2008 10:41:39 -0700 (PDT)
To: users@...
Subject: Re: [dwr-user] signatures help


Hi Dave,

Thanks for the quick reply.
If you look closely at my original e-mail you'll see that I am, indeed,
sending a remote js hash.
It just so happens that the hash contains an array of strings.

Ty

----- Original Message ----
From: "david@..." <david@...>
To: users@...
Sent: Wednesday, April 23, 2008 1:24:05 PM
Subject: RE: [dwr-user] signatures help

1) Your Java method expects a Map not an Array.  To send a map you need to
send a JavaScript hash i.e {}, not a JavaScript array.
var sendThisToSever = {};
sendThisToServer["key1"] = "value1"

or:
var sendThisToServer = new Object();
sendThisToServer.key1 = "value1";

2) You do not need signatures since your map only contains Strings.  That
is just a warning message.  It is letting you know that DWR is assuming
that the contents of the Map  are Strings which in your case is correct.

Original Message:
-----------------
From: tyju tiui jckdnk111@...
Date: Wed, 23 Apr 2008 10:19:46 -0700 (PDT)
To: users@...
Subject: [dwr-user] signatures help


Hi,

I'm having trouble sending a remote array of strings to a DWR-exposed
method which expects a Map.

js:
var params = { 'myArr':["a", "b", "c"] };

java:
public class ParamActions{
    public static boolean storeParams(Map params){
        if(params.get("myArr").getClass().getClass().equals(Class.forName("[
Ljava.lang.String;"))){
            return true
        }else{
            return false;
        }
    }
}

When invoked by DWR, the java code always evaluates to false since the
Object returned by params.get("myArr") is a String and not a String[].
I found the following bug report describing a similar problem:
http://getahead.org/bugs/browse/DWR-96
It says the problem has been fixed in version 3M2 ... is this stable enough
to use?

Also, I see some warning in the DWR log talking about "Missing type info
for storeParams(1<0>). Assuming this is a map with String keys. Please add
to <signatures> in dwr.xml".

I added the following to my dwr.xml but I'm still getting the errors:

...
</allow>
  <signatures>
    <![CDATA[
        import java.util.Map;
        import test.dwr.ParamActions;
        ParamActions.storeParams(Map<String,[Ljava.lang.String;>);
    ]]>
  </signatures>
</dwr>

I'm hoping if I can get the signatures section setup correctly then maybe
my String[] will start magically working.

Thanks,

Ty



      ______________________________________________________________________
______________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



--------------------------------------------------------------------
mail2web.com – Enhanced email for the mobile individual based on
Microsoft®
Exchange - http://link.mail2web.com/Personal/EnhancedEmail



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


      ______________________________________________________________________
______________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



--------------------------------------------------------------------
mail2web LIVE – Free email based on Microsoft® Exchange technology -
http://link.mail2web.com/LIVE



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: RE: signatures help