Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method based on JSON (javascript serialized object notation) for passing object-oriented parameters and system

An object-oriented and parameter-based technology, applied in the direction of program control devices, etc., can solve the problem of complex operation of multiple parameter transfers, and achieve the effect of clear structure, convenient operation, and easy understanding

Inactive Publication Date: 2012-06-20
FOUNDER INTERNATIONAL CO LTD
View PDF1 Cites 26 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0010] The main purpose of the present invention is to provide a method and system for object-based parameter transfer based on JSON, so as to solve the technical problems of complex parameter transfer and complex operation in multiple transfers in the prior art

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method based on JSON (javascript serialized object notation) for passing object-oriented parameters and system
  • Method based on JSON (javascript serialized object notation) for passing object-oriented parameters and system
  • Method based on JSON (javascript serialized object notation) for passing object-oriented parameters and system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0028]如图1所示,本发明中的技术方案主要依赖与json格式。

[0029]JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,易于人们阅读和编写,同时也易于机器解析和生成。JSON建构于两种结构:(1)"名称 / 值”对的集合(A collection of name / value pairs),不同的语言中,它被理解为对象(object),纪录(record),结构(struct),字典(dictionary),哈希表(hash table),有键列表(keyed list),或者关联数组(associative array)。(2)值的有序列表(An ordered list of values)。在大部分语言中,它被理解为数组(array)。

[0030]一个简单的json格式描述如下:User={name="tom”,age=23},地址栏传递的是字符串,action也有自己的数据机构(Map,List),在不同的格式,不同的语言之间传递,自然需要解决格式之间转换的问题,js中Json tostring可以有很多框架提供方法,如Extjs,jquery等;Java中Map,listto json也有第三方类库,如json.jar;经过转换后,地址栏传递的将是这样一种格式userinfo.jsp?json={‘user’:{‘username’:’tom’,’age’=23}}。

[0031]下面将参考附图并结合实施例,来详细说明本发明。

[0032]图1是根据本发明实施例的对象化传参的方法的主要步骤的示意图。如图1所示,该方法包括如下的步骤:

[0033]步骤S1:通过页面js将需要传递的参数构造成json对象,然后再通过页面js将所述json对象转化为字符串、并将所述字符串作为url参数的值,以系统实现约定的key进行url参数的传递。

[0034]步骤S2:通过filter拦截特定参数,并将其转化为对象,具体过程包括:通过filter拦截request请求、并获取特定key的value,将所述value转化成对象。

[0035]现有技术中,参数action是从http请求的request里面获取的,request为所有action提供了参数载体;本发明中,对象化的参数为了不和原来的request内参数混淆,需要有自己的载体...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method based on JSON (javascript serialized object notation) for passing object-oriented parameters and a system. The method includes converting a json object into a character string, and using the character string as a value of a url (uniform resource locator) parameter; intercepting specific parameters by the aid of a filter, and converting the specific parameters into an object; storing the object-oriented parameters by the aid of a parent class of action; increasing or decreasing content in a parameter structure, outputting the character string converted into the json object to a block (script) of a page by the aid of ViewState, and forming a json object of js; acquiring the object-oriented parameters from the parent class of the action, and completing logic processing; and after returning to the page, acquiring global object-oriented parameters from the js for a new page and processing the global object-oriented parameters. The system comprises a conversion module, an intercepting module, a memory module, a forming module, a first acquisition module and a second acquisition module. By the aid of the method and the system, complicated parameters can be passed more easily, and multiple times of parameter passing can be realized more easily.

Description

Technical field [0001] The present invention relates to a method and system for parameter transmission, in particular to a method and system for object parameter transmission based on JSON. Background technique [0002] In the prior art, various specific methods for transferring parameters are as follows: [0003] The page passes parameters to the action: [0004] (1) In the http protocol, the standard URL parameter passing method provided is to follow the "question mark" followed by the key and value of the parameter. [0005] (2) In jsp / servlet, the HttpServletRequest object is used to encapsulate the parameters; Js can only get the whole behind the question mark, and cannot get the value of a parameter separately, for example: the page url request is useinfo? username=tom&age=22, in the servlet, the method to get these 2 parameters is: String username=request.getParameter("username"), String age=request.getParameter("age"); in js: var search=window .1ocation.search, the result...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/44
Inventor 钱骏
Owner FOUNDER INTERNATIONAL CO LTD
Features
  • Generate Ideas
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More