<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ page language="java" import="java.util.*" %> 
<%@ page import = "java.util.ResourceBundle" %>
<% ResourceBundle resource = ResourceBundle.getBundle("devops");
	String driver=resource.getString("driver");
	String url=resource.getString("url") + "/" + resource.getString("database"); 
	String user=resource.getString("user");
	String password=resource.getString("password"); 
	String stage=resource.getString("stage"); %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>DevOps</title>
	</head>
	<body>

		<sql:setDataSource var="db" driver="<%=driver%>"
		     url="<%=url%>" user="<%=user%>"  password="<%=password%>" />
		
		<sql:query dataSource="${db}" var="result">
			SELECT * FROM persons WHERE login = ?
			<sql:param value="${param.login}" ></sql:param>
		</sql:query>
		
	
		<h1>This is DevOps 0.1!</h1>
		<br/>
		
		<c:forEach var="row" items="${result.rows}">
			<table>
				<tr>
					<td>Hello ${row.first_name} ${row.last_name} aka ${param.login}!</td>
				</tr>
				<tr>
					<td><br/></td>
				</tr>
				<tr>
					<td>Welcome to DevOps @ <%=stage%> again!</td>
				</tr>
			</table>
		</c:forEach>

	</body>
</html>