1 |
torben |
593 |
package com.grundfos.gmatou.dataupload;
|
2 |
|
|
|
3 |
|
|
import java.io.IOException;
|
4 |
|
|
import java.sql.Connection;
|
5 |
|
|
import java.sql.PreparedStatement;
|
6 |
|
|
import java.sql.ResultSet;
|
7 |
|
|
|
8 |
|
|
import javax.servlet.ServletException;
|
9 |
|
|
import javax.servlet.http.HttpServlet;
|
10 |
|
|
import javax.servlet.http.HttpServletRequest;
|
11 |
|
|
import javax.servlet.http.HttpServletResponse;
|
12 |
|
|
import java.util.*;
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
public class EditConfig extends HttpServlet {
|
16 |
|
|
private static final long serialVersionUID = 1L;
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
public EditConfig() {
|
20 |
|
|
super();
|
21 |
|
|
// TODO Auto-generated constructor stub
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
25 |
|
|
try
|
26 |
|
|
{
|
27 |
|
|
Connection conn = DBConnection.getDbConnection();
|
28 |
|
|
PreparedStatement stmt = conn.prepareStatement("SELECT modified,value FROM config");
|
29 |
|
|
ResultSet rs = stmt.executeQuery();
|
30 |
|
|
|
31 |
|
|
Map<String,String> map = new HashMap<String,String>();
|
32 |
|
|
while (rs.next()) {
|
33 |
|
|
map.put("modified", rs.getString(1));
|
34 |
|
|
map.put("value", rs.getString(2));
|
35 |
|
|
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
rs.close();
|
39 |
|
|
stmt.close();
|
40 |
|
|
conn.close();
|
41 |
|
|
|
42 |
|
|
request.setAttribute("map", map);
|
43 |
|
|
getServletContext().getRequestDispatcher("/editconfig.jsp").forward(request,response);
|
44 |
|
|
|
45 |
|
|
} catch (Exception e) {
|
46 |
|
|
throw new ServletException(e);
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
}
|
50 |
|
|
}
|