JSON:
JavaScript Object Notation which is used to get data on .html page .jsp page
JSON is an simplified way to describe the whole List data into structured format
JSON has specific Format which you can read .
I will explain the way to convert LIST data into JSON.
eg:
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
class emp
{
Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
List list=new ArrayList()
list.add("kalpesh");
list.add("amol");
String jsonString=gson.toJson(hbmNewSequenceList); // you access this String into .jsp page
}
.jsp FILE
var globaldata=$.parseJSON(data); //data is an jsonString in .java file
this description is simply an idea of using of json into jsp & java file
globaldata is an array type
JavaScript Object Notation which is used to get data on .html page .jsp page
JSON is an simplified way to describe the whole List data into structured format
JSON has specific Format which you can read .
I will explain the way to convert LIST data into JSON.
eg:
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
class emp
{
Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
List list=new ArrayList()
list.add("kalpesh");
list.add("amol");
String jsonString=gson.toJson(hbmNewSequenceList); // you access this String into .jsp page
}
.jsp FILE
var globaldata=$.parseJSON(data); //data is an jsonString in .java file
this description is simply an idea of using of json into jsp & java file
globaldata is an array type
No comments:
Post a Comment