I try to send a a serlialized array using the jQuery method
serializeArray(). Afterwards I send an Ajax "PUT" request to the
according URL.
like this:
var data = $("#createForm").serializeArray();
$.ajax({
type: "PUT",
url: "http://localhost:9000/leifg",
data: data
});
I can debug in the backend method public static void createJson(String
screenName, String data), but the String variable data is null.
If I change the signature to public static void createJson(String
screenName, HashMap<String, String> data), I will just get an empty
HashMap.
In the debug mode, I can see, that there is a HashMap inside the
params variable called "data" which contains all the data from the
form.
My question now is:
- how can I access this Hashmap (params.get("data", HashMap.class);
didn't work)?
- is there a better way to deal with JSON/String-Arrays in the play!
backend?
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
In the java backend I get the variable data, which is a HashMap and
looks something like this:
{body=[Ljava.lang.String;@31133976,
tweetSpanEnd=[Ljava.lang.String;@65218b25,
queueType=[Ljava.lang.String;@7d365e01,
screenName=[Ljava.lang.String;@78189538,
queueName=[Ljava.lang.String;@7c55d3df,
queueDescription=[Ljava.lang.String;@66c9153e,
tweetSpanStart=[Ljava.lang.String;@1b91ce2a,
queueInterval=[Ljava.lang.String;@176358a,
tweetSpanEnabled=[Ljava.lang.String;@77b4f7c5}
regards
leif
My advice:
public static void yop(String body) {
// here body contains the json string
// use GSON to parse it dynamically