public class Employee3 {
private String Employee;
private String Input_Weight1;
private String Input_Weight2;
private String Input_Weight3;
public String getEmployee() {
return Employee;
}
public void setEmployee(String employee) {
Employee = employee;
}
public String getInput_Weight1() {
return Input_Weight1;
}
public void setInput_Weight1(String input_Weight1) {
Input_Weight1 = input_Weight1;
}
public String getInput_Weight2() {
return Input_Weight2;
}
public void setInput_Weight2(String input_Weight2) {
Input_Weight2 = input_Weight2;
}
public String getInput_Weight3() {
return Input_Weight3;
}
public void setInput_Weight3(String input_Weight3) {
Input_Weight3 = input_Weight3;
}
}
List<String> Employee = new ArrayList<>();
List<String> Input_Weight1 = new ArrayList<>();
List<String> Input_Weight2 = new ArrayList<>();
List<String> Input_Weight3 = new ArrayList<>();
Employee.add("сотрудник1");
Employee.add("сотрудник2");
Employee.add("сотрудник3");
Input_Weight1.add("0.2");
Input_Weight1.add("0");
Input_Weight1.add("0");
Input_Weight2.add("0.4");
Input_Weight2.add("0");
Input_Weight2.add("0");
Input_Weight3.add("0.3");
Input_Weight3.add("0");
Input_Weight3.add("0");
Employee3 employee3=null;
JSONArray jsonobj = new JSONArray();
// List<Employee3> map_list=new ArrayList<>();
for (int i=0; i<Employee.size(); i++){
employee3=new Employee3();
employee3.setEmployee(Employee.get(i));
employee3.setInput_Weight1(Input_Weight1.get(i));
employee3.setInput_Weight2(Input_Weight2.get(i));
employee3.setInput_Weight3(Input_Weight3.get(i));
// map_list.add(employee3);
// System.out.println(Employee.get(i));
jsonobj.put(employee3);
}
Gson gson1 = new Gson();
System.out.println(gson1.toJson(jsonobj));
List<String> Employee = new ArrayList<>();
List<String> Input_Weight1 = new ArrayList<>();
List<String> Input_Weight2 = new ArrayList<>();
List<String> Input_Weight3 = new ArrayList<>();
Employee.add("сотрудник1");
Employee.add("сотрудник2");
Employee.add("сотрудник3");
Input_Weight1.add("0.2");
Input_Weight1.add("0");
Input_Weight1.add("0");
Input_Weight2.add("0.4");
Input_Weight2.add("0");
Input_Weight2.add("0");
Input_Weight3.add("0.3");
Input_Weight3.add("0");
Input_Weight3.add("0");
Employee3 employee3=null;
JSONArray jsonobj = new JSONArray();
// List<Employee3> map_list=new ArrayList<>();
for (int i=0; i<Employee.size(); i++){
employee3=new Employee3();
employee3.setEmployee(Employee.get(i));
employee3.setInput_Weight1(Input_Weight1.get(i));
employee3.setInput_Weight2(Input_Weight2.get(i));
employee3.setInput_Weight3(Input_Weight3.get(i));
// map_list.add(employee3);
// System.out.println(Employee.get(i));
jsonobj.put(employee3);
}
Gson gson1 = new Gson();
System.out.println(gson1.toJson(jsonobj));
[{"Employee":"сотрудник1","Input_Weight1":"0.2","Input_Weight2":"0.4","Input_Weight3":"0.3"},{"Employee":"сотрудник2","Input_Weight1":"0","Input_Weight2":"0","Input_Weight3":"0"},{"Employee":"сотрудник3","Input_Weight1":"0","Input_Weight2":"0","Input_Weight3":"0"}]
function check_Employee(){
var table = document.getElementById('Employees');
var arrayList = [];
for (var i = 1; i < table.rows.length-2; i++) {
var map_list = {};
[].forEach.call(document.getElementsByTagName("input"), function (elements_form) {
if (([elements_form.getAttribute('id')].toString()).indexOf("Input_Weight_"+i) != -1) {
map_list[elements_form.getAttribute('id')] = document.getElementById(elements_form.getAttribute('id')).value;
}
});
var employeeObject = new Employee(table.rows[i+1].cells[0].innerHTML, map_list);
arrayList.push(employeeObject);
}
console.log(JSON.stringify(arrayList));
}
// конвертируем JSON Object в массив
function JSONtoArray(JSONObject) {
var result = [];
for(var k in JSONObject) {
var v = JSONObject[k];
result.push(k, v);
}
return result;
}
$.getJSON( "employees?region="+encodeURI(selected), { selected_region: selected } )
.done(function( jsondata ) {
var result=JSONtoArray(jsondata[3].map_list);
// далее работаем с массивом
}
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 2001))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2001))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.22)(PORT = 2001))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2001))
)
)
SERVER01_DBORACLE_LOCAL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.22)(PORT = 2001))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dboracle)
)
)
SERVER01_DBORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 2001))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dboracle)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2001))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_DBORACLE =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 2001))
LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 13-APR-2017 16:27:57
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=2001)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Production
Start Date 13-APR-2017 15:28:54
Uptime 0 days 0 hr. 59 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\DataBases\Oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
Listener Log File D:\DataBases\Oracle\diag\tnslsnr\SERVER01\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2001)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC2001ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.22)(PORT=2001)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC2001ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=SERVER01)(PORT=5500))(Security=(my_wallet_directory=D:\DATABASES\ORACLE\admin\dboracle\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dboracle" has 1 instance(s).
Instance "dboracle", status READY, has 1 handler(s) for this service...
Service "dboracleXDB" has 1 instance(s).
Instance "dboracle", status READY, has 1 handler(s) for this service...
Service "dboracle" has 1 instance(s).
Instance "dboracle", status READY, has 1 handler(s) for this service...
Service "dboracleXDB" has 1 instance(s).
Instance "dboracle", status READY, has 1 handler(s) for this service...