You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <%@ page import="java.sql.*,oracle.jdbc.driver.OracleDriver"%>
  2. <%@ page trimDirectiveWhitespaces="true" %>
  3. <%
  4. Class.forName("oracle.jdbc.driver.OracleDriver");
  5. Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","admin");
  6. Statement stmt = conn.createStatement();
  7. int index=request.getRequestURI().lastIndexOf('/');
  8. String id = request.getRequestURI().substring(index, request.getRequestURI().length());
  9. id = id.replace("/", "");
  10. String status = "";
  11. String comp_id = "";
  12. String sql = "SELECT case when comp_status = 'A' then 'assigned' when comp_status = 'P' then 'pending' when comp_status = 'N' then 'open' else 'completed' end as status FROM COMP_REG where comp_id="+id;
  13. //out.println(sql);
  14. ResultSet rs = stmt.executeQuery(sql);
  15. while(rs.next())
  16. {
  17. comp_id = rs.getString("comp_id");
  18. status = rs.getString("status");
  19. }
  20. %>{Complaint ID': <%=comp_id %>, 'status': '<%= status %>'}<%
  21. // Returns all employees (active and terminated) as json.
  22. response.setContentType("application/json");
  23. %>