<%@ page import="java.sql.*,oracle.jdbc.driver.OracleDriver"%> <%@ page trimDirectiveWhitespaces="true" %> <% Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","admin"); Statement stmt = conn.createStatement(); int index=request.getRequestURI().lastIndexOf('/'); String id = request.getRequestURI().substring(index, request.getRequestURI().length()); id = id.replace("/", ""); String status = ""; String comp_id = ""; 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; //out.println(sql); ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { comp_id = rs.getString("comp_id"); status = rs.getString("status"); } %>{Complaint ID': <%=comp_id %>, 'status': '<%= status %>'}<% // Returns all employees (active and terminated) as json. response.setContentType("application/json"); %>