<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ page import="java.io.*" %>
<% request.setCharacterEncoding("UTF-8"); %>
<%
String curPath="", tmpPath="";
String UserID="", FIRTextData="";

UserID = request.getParameter("UserID");
FIRTextData = request.getParameter("FIRTextData");

  // Get current path
//  tmpPath = getServletContext().getRealPath(request.getRequestURI());
  tmpPath = getServletContext().getRealPath("/");
  tmpPath = tmpPath.substring(0, tmpPath.lastIndexOf("\\"));
  curPath = tmpPath + "\\FDB\\";
  
File f = null, dir = null;
FileWriter fw = null;
  
  // Set filename using UserID
  dir = new File(curPath);
  if (!dir.exists()) {
	dir.mkdir();
  }
  f = new File(curPath + UserID  + ".FDB");
  f.createNewFile();
  
  fw = new FileWriter(f);
  
  fw.write(UserID); fw.write("\n");
  fw.write(String.format("%d", FIRTextData.length())); fw.write("\n");
  fw.write(FIRTextData); fw.write("\n");
  fw.flush();
  fw.close();
  
%>

<html>

<body>

<br>
<br>

<center>
<hr>
<H2>Demo Page for Enrollment (Result)</H2>
<hr>
<br>

<font size=5 color=#000080><b>Registration Success!</b></font>
<hr noshade width=300>

<br>
<br>

<b>Registration Information</b>
<p>

<table border=1 cellpadding=3>
<tr><th width=200>Item</th><th width=100>Value</th></tr>
<tr><td align=center>User ID</td><td align=center><%= UserID %></td></tr>
<tr><td align=center>FIR Data size</td><td align=center><%= FIRTextData.length() %></td></tr>
</table>
<p>

<br>
<input type=button OnClick="javascript:location.href='./default.jsp';" value=" << Return to Home ">
<br>
<p>

<hr>
<font size=2>Copyright ⓒ 2008. UNION COMMUNITY Co., Ltd.</font>
</center>

</body>
</html>