Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates for SPR-9244

  • Loading branch information...
commit 4810d5b2236714c7dcd9a7bdd8d9f95b6356568f 1 parent 4153f09
@rstoyanchev rstoyanchev authored
Showing with 61 additions and 59 deletions.
  1. +20 −31 SPR-9244/README.md
  2. +41 −28 SPR-9244/src/main/webapp/WEB-INF/views/home.jsp
View
51 SPR-9244/README.md
@@ -1,4 +1,3 @@
-
Examples
========
@@ -6,47 +5,37 @@ Examples
{"value1":1680,"value2":1050}
value1=1680&value2=1050
value1=1680&value2=1050
-````
-````
-{"numArr":[1,2,3]}
-numArr%5B%5D=1&numArr%5B%5D=2&numArr%5B%5D=3
-numArr[]=1&numArr[]=2&numArr[]=3
-````
+{"nestedObject":{"provider":"facebook","user_id":1256789,"access_token":"foo"}}
+nestedObject%5Bprovider%5D=facebook&nestedObject%5Buser_id%5D=1256789&nestedObject%5Baccess_token%5D=foo
+nestedObject[provider]=facebook&nestedObject[user_id]=1256789&nestedObject[access_token]=foo
+
+{"nestOnce":{"nestTwice":{"value1":123,"value2":456}}}
+nestOnce%5BnestTwice%5D%5Bvalue1%5D=123&nestOnce%5BnestTwice%5D%5Bvalue2%5D=456
+nestOnce[nestTwice][value1]=123&nestOnce[nestTwice][value2]=456
+
+{"arr":[1,2,3]}
+arr%5B%5D=1&arr%5B%5D=2&arr%5B%5D=3
+arr[]=1&arr[]=2&arr[]=3
-````
{"objArr":[{"name":"o1","value":"v1"},{"name":"o2","value":"v2"}]}
objArr%5B0%5D%5Bname%5D=o1&objArr%5B0%5D%5Bvalue%5D=v1&objArr%5B1%5D%5Bname%5D=o2&objArr%5B1%5D%5Bvalue%5D=v2
objArr[0][name]=o1&objArr[0][value]=v1&objArr[1][name]=o2&objArr[1][value]=v2
-````
-
-````
-{"nestedObj":{"provider":"facebook","user_id":1256789,"access_token":"foo"}}
-nestedObj%5Bprovider%5D=facebook&nestedObj%5Buser_id%5D=1256789&nestedObj%5Baccess_token%5D=foo
-nestedObj[provider]=facebook&nestedObj[user_id]=1256789&nestedObj[access_token]=foo
-````
-````
-{"nestOnce":{"nestTwice":{"value1":123,"value2":456}}}
-nestOnce%5BnestTwice%5D%5Bvalue1%5D=123&nestOnce%5BnestTwice%5D%5Bvalue2%5D=456
-nestOnce[nestTwice][value1]=123&nestOnce[nestTwice][value2]=456
-````
+{"nestedNumArray1":{"numArr":[1,2,3]},"nestedNumArray2":{"numArr":[1,2,3]}}
+nestedNumArray1%5BnumArr%5D%5B%5D=1&nestedNumArray1%5BnumArr%5D%5B%5D=2&nestedNumArray1%5BnumArr%5D%5B%5D=3&nestedNumArray2%5BnumArr%5D%5B%5D=1&nestedNumArray2%5BnumArr%5D%5B%5D=2&nestedNumArray2%5BnumArr%5D%5B%5D=3
+nestedNumArray1[numArr][]=1&nestedNumArray1[numArr][]=2&nestedNumArray1[numArr][]=3&nestedNumArray2[numArr][]=1&nestedNumArray2[numArr][]=2&nestedNumArray2[numArr][]=3
-````
{"1":{"value1":123,"value2":456},"15":{"value1":123,"value2":456}}
1%5Bvalue1%5D=123&1%5Bvalue2%5D=456&15%5Bvalue1%5D=123&15%5Bvalue2%5D=456
1[value1]=123&1[value2]=456&15[value1]=123&15[value2]=456
-````
-````
-{"nested":{"1":{"value1":123,"value2":456},"15":{"value1":123,"value2":456}}}
-nested%5B1%5D%5Bvalue1%5D=123&nested%5B1%5D%5Bvalue2%5D=456&nested%5B15%5D%5Bvalue1%5D=123&nested%5B15%5D%5Bvalue2%5D=456
-nested[1][value1]=123&nested[1][value2]=456&nested[15][value1]=123&nested[15][value2]=456
-````
+{"nestedObject":{"1":{"value1":123,"value2":456},"15":{"value1":123,"value2":456}}}
+nestedObject%5B1%5D%5Bvalue1%5D=123&nestedObject%5B1%5D%5Bvalue2%5D=456&nestedObject%5B15%5D%5Bvalue1%5D=123&nestedObject%5B15%5D%5Bvalue2%5D=456
+nestedObject[1][value1]=123&nestedObject[1][value2]=456&nestedObject[15][value1]=123&nestedObject[15][value2]=456
-````
-{"a":{"b":1,"c":2},"d":[3,4,{"e":5}]}
-a%5Bb%5D=1&a%5Bc%5D=2&d%5B%5D=3&d%5B%5D=4&d%5B2%5D%5Be%5D=5
-a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5
+{"nestedObject":{"b":1,"c":2},"nestedMixedArray":[3,4,{"e":5}]}
+nestedObject%5Bb%5D=1&nestedObject%5Bc%5D=2&nestedMixedArray%5B%5D=3&nestedMixedArray%5B%5D=4&nestedMixedArray%5B2%5D%5Be%5D=5
+nestedObject[b]=1&nestedObject[c]=2&nestedMixedArray[]=3&nestedMixedArray[]=4&nestedMixedArray[2][e]=5
````
View
69 SPR-9244/src/main/webapp/WEB-INF/views/home.jsp
@@ -4,8 +4,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<script type="text/javascript"
- src="<c:url value="/resources/jquery/1.6/jquery.js" />"></script>
+<script type="text/javascript" src="<c:url value="/resources/jquery/1.6/jquery.js" />"></script>
+<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js"></script>
+
<title>SPR-9244</title>
</head>
<body>
@@ -13,32 +14,24 @@
<div id="results"></div>
<script>
- function append(params) {
- var encodedParams = jQuery.param(params);
+
+ function append(object) {
+
+ $("#results").append(JSON.stringify(object) + "<br>");
+
+ var encodedParams = jQuery.param(object);
+ // $("#results").append(encodedParams + "<br>");
+ $("#results").append("jQuery: " + decodeURIComponent(encodedParams) + "<br>");
- $("#results").append(JSON.stringify(params) + "<br>");
- $("#results").append(encodedParams + "<br>");
- $("#results").append(decodeURIComponent(encodedParams) + "<hr>");
+ encodedParams = dojo.objectToQuery(object);
+ // $("#results").append(encodedParams + "<br>");
+ $("#results").append("Dojo: " + decodeURIComponent(encodedParams) + "<hr>");
}
append({ value1 : 1680, value2 : 1050 });
append({
- numArr : [ 1, 2, 3 ]
- });
-
- append({
- objArr : [ {
- name : "o1",
- value : "v1"
- }, {
- name : "o2",
- value : "v2"
- } ]
- });
-
- append({
- nestedObj : {
+ nestedObject : {
provider : 'facebook',
user_id : 1256789,
access_token : 'foo'
@@ -55,6 +48,29 @@
});
append({
+ arr : [ 1, 2, 3 ]
+ });
+
+ append({
+ objArr : [ {
+ firstName : "Werner",
+ lastName : "Herzog"
+ }, {
+ firstName : "Wim",
+ lastName : "Wenders"
+ } ]
+ });
+
+ append({
+ nestedNumArray : {
+ numArr : [ 1, 2, 3 ]
+ },
+ nestedMixedArray : {
+ numArr : [ 1, 2, { foo : "bar"}, 3, 4 ]
+ }
+ });
+
+ append({
'1' : {
value1 : 123,
value2 : 456
@@ -66,7 +82,7 @@
});
append({
- nested : {
+ nestedObject : {
'1' : {
value1 : 123,
value2 : 456
@@ -79,11 +95,8 @@
});
append({
- a : {
- b : 1,
- c : 2
- },
- d : [ 3, 4, {e : 5} ]
+ nestedObject : {b : 1, c : 2},
+ nestedMixedArray : [ 3, 4, {e : 5} ]
});
Please sign in to comment.
Something went wrong with that request. Please try again.