This question is locked. New answers and comments are not allowed.
When defining a Grid (using JSP wrapper) my servlet receives the parameters pageSize, take, skip and page as a JSON string in the name part of the parameters. I mean, the servlet receives one single parameters which name is: {"take":10,"skip":0,"page":1,"pageSize":10} and the value is empty.
Equivalent code using JavaScript receives 4 parameters:
Equivalent code using JavaScript receives 4 parameters:
- name: take, value: 10
- name: skip, value: 0
- name: page, value: 1
- name: pageSize, value: 10
Is this difference intentional?
Is correct encoding a JSON string in the name side of the parameter?
Is correct encoding a JSON string in the name side of the parameter?
8 Answers, 1 is accepted
0

OnaBai
Top achievements
Rank 2
answered on 18 Nov 2012, 12:46 AM
The problem is in TransportTag.doEndTag that when parameterMap is null (not defined) defines function(options,type){return JSON.stringify(options);} as parameterMap preventing in JavaScript code RemoteTransport.setup from invoking identity function as happens for other frameworks.
0

youssef
Top achievements
Rank 1
answered on 18 Nov 2012, 03:12 PM
you must do that : give a name to parameters
{paramName1: {"take":10,"skip":0,"page":1,"pageSize":10}}
{paramName1: {"take":10,"skip":0,"page":1,"pageSize":10}}
0

OnaBai
Top achievements
Rank 2
answered on 18 Nov 2012, 10:43 PM
The question is that I don't do it but Kendo UI Java code that implements the taglib.
And, btw, I agree with you that if I decide to send it as JSON I would have transmitted it in the value side of the parameter and not as the name..
And, btw, I agree with you that if I decide to send it as JSON I would have transmitted it in the value side of the parameter and not as the name..
0
Hello,
Atanas Korchev
the Telerik team
You need to specify a parameterMap attribute in order to avoid this behavior (or treat the request body as JSON and parse it). We are sending the parameters as JSON by default to make it easier to parse on the server side.
Regards,Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

OnaBai
Top achievements
Rank 2
answered on 19 Nov 2012, 08:53 AM
Atenas,
Two questión:
1. It behaves different than if you use JavaScript for initialized the grid -> annoying
2. JSON is sent as the parameter name and not as the parameter value -> bad practice since before hand you don't know how to retrieve it from the list
Regards
0
Hi Emilio,
Regards,
Atanas Korchev
the Telerik team
As I said in my first reply we are doing this to make parsing the request easier. If you don't like it specify a parameterMap as I said in my first reply:
parameterMap="myParameterMap"
<scirpt>
function myParameterMap(options) {
return options;
}
</script>
Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

OnaBai
Top achievements
Rank 2
answered on 19 Nov 2012, 10:47 AM
Hi Atanas,
First of all I'd like to thank you for your fast answer.
Said so, I'm afraid I did not stated the problem correctly. I'm going to provide a little more information and hopefully now it is going to be easier to understand.
Using KendoUI Web (HTML+JavaScript) I wrote:
What really matters is only this part:
When I use JSP wrap, I translated it into this:
And again, what really matters is:
As far I as I understand they are equivalent and I expect that my servlet "/ListBeer" might be the same for both.
Then, I use Chrome for checking network traffic and I see in (attached captures) that the parameters "Query String Parameters" are not the same for HTML.png and JSP.png.
I know how to use parameterMap and if KendoUI is not making both products (Web and JSP wrapper) 100% compatible I will have to go that path. BUT since this is a Beta and you want to hear from us, I've decided to share with you that I have to write extra code for making both compatible and migration will imply extra work.
Then, we might enter a philosophical question regarding the fact that json is transmitted as name and not as value but for me the most important question is understand if KendoUI strategy is make both products 100% compatible or just 99.9% :-)
Thanks in advance and my best regards
Emiliano
First of all I'd like to thank you for your fast answer.
Said so, I'm afraid I did not stated the problem correctly. I'm going to provide a little more information and hopefully now it is going to be easier to understand.
Using KendoUI Web (HTML+JavaScript) I wrote:
$(
"#grid"
).kendoGrid({
columns: [
{ field:
"name"
, title:
"Name"
},
{ field:
"abv"
, title:
"ABV"
, format:
"{0:n1}"
, width:
"50"
},
{ field:
"style"
, title:
"Style"
, format:
"{0:n1}"
},
{ field:
"category"
, title:
"Category"
, format:
"{0:n1}"
}
],
pageable:
true
,
sortable:
true
,
filterable:
false
,
groupable:
false
,
dataSource:{
pageSize: 10,
serverPaging:
true
,
transport: {
read:{
url:
"/ListBeer"
,
type:
"GET"
,
contentType:
"application/json"
}
},
schema: {
data:
"data"
,
total:
"total"
,
groups:
"data"
,
model: {
fields:{
name: { type:
"string"
},
abv: { type:
"number"
},
style: { type:
"string"
},
category:{ type:
"string"
}
}
}
}
}
})
dataSource:{
pageSize: 10,
serverPaging:
true
,
transport: {
read:{
url:
"/ListBeer"
,
type:
"GET"
,
contentType:
"application/json"
}
},
<
kendo:grid
name
=
"grid"
pageable
=
"true"
sortable
=
"true"
filterable
=
"false"
groupable
=
"false"
>
<
kendo:grid-columns
>
<
kendo:grid-column
title
=
"Name"
field
=
"name"
/>
<
kendo:grid-column
title
=
"ABV"
field
=
"abv"
format
=
"{0:n1}"
width
=
"50px"
/>
<
kendo:grid-column
title
=
"Style"
field
=
"style"
/>
<
kendo:grid-column
title
=
"Category"
field
=
"category"
/>
</
kendo:grid-columns
>
<
kendo:dataSource
pageSize
=
"10"
serverPaging
=
"true"
>
<
kendo:dataSource-transport
>
<
kendo:dataSource-transport-read
url
=
"/ListBeer"
type
=
"GET"
contentType
=
"application/json"
/>
</
kendo:dataSource-transport
>
<
kendo:dataSource-schema
data
=
"data"
total
=
"total"
groups
=
"data"
>
<
kendo:dataSource-schema-model
>
<
kendo:dataSource-schema-model-fields
>
<
kendo:dataSource-schema-model-field
name
=
"name"
type
=
"string"
/>
<
kendo:dataSource-schema-model-field
name
=
"abv"
type
=
"number"
/>
<
kendo:dataSource-schema-model-field
name
=
"style"
type
=
"string"
/>
<
kendo:dataSource-schema-model-field
name
=
"category"
type
=
"string"
/>
</
kendo:dataSource-schema-model-fields
>
</
kendo:dataSource-schema-model
>
</
kendo:dataSource-schema
>
</
kendo:dataSource
>
</
kendo:grid
>
<
kendo:dataSource
pageSize
=
"10"
serverPaging
=
"true"
>
<
kendo:dataSource-transport
>
<
kendo:dataSource-transport-read
url
=
"/ListBeer"
type
=
"GET"
contentType
=
"application/json"
/>
</
kendo:dataSource-transport
>
Then, I use Chrome for checking network traffic and I see in (attached captures) that the parameters "Query String Parameters" are not the same for HTML.png and JSP.png.
I know how to use parameterMap and if KendoUI is not making both products (Web and JSP wrapper) 100% compatible I will have to go that path. BUT since this is a Beta and you want to hear from us, I've decided to share with you that I have to write extra code for making both compatible and migration will imply extra work.
Then, we might enter a philosophical question regarding the fact that json is transmitted as name and not as value but for me the most important question is understand if KendoUI strategy is make both products 100% compatible or just 99.9% :-)
Thanks in advance and my best regards
Emiliano
0
Accepted
Hi,
Atanas Korchev
the Telerik team
Thank you for your feedback. We will see if other users find this behavior abnormal and decide whether to send parameters as json by default or not.
Regards,Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!