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-96It 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@...