官术网_书友最值得收藏!

  • qooxdoo Beginner's Guide
  • Rajesh Kumar Bachu Mohamed Raffi
  • 449字
  • 2021-08-20 15:45:11

Passing data to the server

qooxdoo uses the JSON format to transfer the data between the client browser and the web server. JSON is a light-weight data interchange format. JSON is very light when compared to the XML format. It is easy for humans to read and write. It is easy for machines to parse and generate. We have mentioned the JSON standard format in this section. This information is good enough to work with JSON. If you want to read more, you can visit the JSON website (http://www.json.org/).

JSON standard format

The Date object is an exception in the formatting as JavaScript does not have a literal syntax for the Date object.

Date objects are sent as the following tokens:

  • The string—new Date (Date.UTC(
  • The year, integer; for example, 2006
  • A comma
  • The month, 0-relative integer; for example, 5 (that is, June)
  • A comma
  • The day of the month, integer, range: 1-31
  • A comma
  • The hour of the day on a 24-hour clock, integer, range: 0-23
  • A comma
  • The minute of the hour, integer, range: 0-59
  • A comma
  • The second within the minute, integer, range: 0-59
  • A comma
  • The milliseconds within the second, integer, range: 0-999
  • The string—))

A resulting date representation might therefore be:

new Date(Date.UTC(2006,5,20,22,18,42,223))

While working with date strings, you must take care with the following:

  • Whitespace: The following points should be remembered:
    • When generating these date strings, implementations should not add whitespace before, after, or between any of the fields within the date string.
    • When parsing these date strings, implementations should allow whitespace before, after, or between any of the fields within the date string.
  • Numbers: The following points should be remembered:
    • When generating these date strings, implementations must not add leading zeros to the numeric values in the date string. Doing so will cause them to be parsed as octal values. Numbers must be passed in decimal (base 10) notation without leading zeros.
    • When parsing these date strings, implementations must take the integer value of numeric portions of the string as base 10 values, even if leading zeros appear in the string representation of the numbers.

Within the JSON protocol and in JSON messages between peers, Date objects are always passed in UTC format.

A sample JSON content to explain the file menu contents that contain the members, pairs, values or strings, arrays, and so on in the JSON format is as follows:

{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

What just happened?

We got to know about the data format that is passed between client and server in qooxdoo applications.

主站蜘蛛池模板: 蓝山县| 芜湖县| 化州市| 罗平县| 玉林市| 垦利县| 朝阳市| 福海县| 冕宁县| 锡林浩特市| 康平县| 梁平县| 行唐县| 西充县| 都昌县| 天水市| 紫金县| 比如县| 油尖旺区| 安平县| 老河口市| 杭锦旗| 邵东县| 焦作市| 封开县| 巴林左旗| 巴彦淖尔市| 石嘴山市| 苍梧县| 定远县| 大石桥市| 五指山市| 南木林县| 宁阳县| 尖扎县| 军事| 蒙阴县| 临湘市| 高密市| 宜丰县| 东阳市|