compile('org.apache.hive:hive-jdbc:2.0.0')
exclude("META-INF/*.LIST","META-INF/*.SF","META-INF/*.DSA","META-INF/*.RSA")
Calendar fDATETIME = Calendar.getInstance(); // creates calendar
Calendar tDATETIME = Calendar.getInstance();
SimpleDateFormat ShortDateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
SimpleDateFormat DateFormatForSQLOracle = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fDATETIME.setTime(ShortDateFormat.parse(DATETIME_FROM));
tDATETIME.setTime(ShortDateFormat.parse(DATETIME_TO));
try (Connection conn = DriverManager.getConnection(DB_URL_Connection, DB_UserName, DB_Password)) {
PreparedStatement prepStmt = conn.prepareStatement(sql);
prepStmt.setTimestamp(1, java.sql.Timestamp.valueOf(DateFormatForSQLOracle.format(fDATETIME.getTime())));
prepStmt.setTimestamp(2, java.sql.Timestamp.valueOf(DateFormatForSQLOracle.format(tDATETIME.getTime())));
prepStmt.setString(3, "%Хост: %");
ResultSet result = prepStmt.executeQuery();
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"}]
<c:set var="rezult.a" value="4"/>
<c:set var="rezult.b" value="10"/>
<%
Float result_A = Float.valueOf("" + pageContext.getAttribute("rezult.a", PageContext.PAGE_SCOPE));
Float result_B = Float.valueOf("" + pageContext.getAttribute("rezult.b", PageContext.PAGE_SCOPE));
MathContext myMathContext = new MathContext(15, RoundingMode.HALF_UP);
BigDecimal bd;
bd = new BigDecimal((float)result_A/result_B, myMathContext);
BigDecimal bdRounded = bd.setScale(2, RoundingMode.HALF_UP);
pageContext.getSession().setAttribute("RESULT", bdRounded.floatValue());
%>
<br>
RESULT: ${RESULT}
RESULT: 0.4