<%@ page import="java.lang.*" %>

<html>
<body>
<h1>Group Free Times JSP</h1>
<p>

<%
    String freeTimes = (String)request.getAttribute("free times");
    String dayFreeTimes;
    String days = "TWRF";
    int eIndex;

if (!freeTimes.equals("")) {    
    for (int i = 0; i < 4; i++) {
        eIndex = freeTimes.indexOf(days.charAt(i)) - 1;
        dayFreeTimes = freeTimes.substring(0, eIndex);
        out.print(dayFreeTimes + "<br />");
        freeTimes = freeTimes.substring(eIndex);
    }

    out.println(freeTimes);
}
%>

</p>
<p>
<%
    String errorMessage = (String)request.getAttribute("errorMessage");
    out.print(errorMessage);
%>
</p>
</body>
</html>