<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Kalkulator</title>
<link rel="stylesheet" type="text/css" href="/styl.css"/>
</head>
<body>
<h1>Może chcesz coś obliczyć?...</h1>

<p>Podaj działanie:</p>
<form class="kalkulator" method="post">
<input type="number" name="arg1" value="${param.arg1}">

<select name="operacja">
<c:forEach var="op" items="+,-,*,/">
	<c:choose>
	<c:when test="${op == param.operacja}">
		<option value="${op}" selected="selected">${op}</option>
	</c:when>
	<c:otherwise>
		<option value="${op}">${op}</option>
	</c:otherwise>
	</c:choose>
</c:forEach>
</select>

<input type="number" name="arg2" value="${param.arg2}">
<button>Oblicz</button>
</form>

<c:if test="${not empty wynik}">
	<div class="wynik">
	${param.arg1} ${param.operacja} ${param.arg2} = <strong>${wynik}</strong>
	</div>
</c:if>

<div><a href="/kalkulator/historia">Historia działań</a></div>

</body>
</html>
