import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.sql.*;
import java.util.*;

public class list extends HttpServlet {
    Config conf = new Config();
    public void service(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {

	if(request.getMethod().equals("POST")){
	    doPost(request,response);
	    return ;
	}
	response.setContentType("text/html; charset=Shift_JIS");
	PrintWriter out = response.getWriter();
	System_Controller cntl =new System_Controller(out);
	cntl.print_index();
    } 
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { 
	response.setContentType("text/html; charset=Shift_JIS");
	String[] attribute=conf.get_attribute_parameter(); 
	String[] attribute_jp=conf.get_attribute_parameter_jp();
	String[] input_data=new String[attribute.length];
	PrintWriter out = response.getWriter();
	System_Controller cntl =new System_Controller(out);
	

	// 要求文字コードのセット
	//	request.setCharacterEncoding("Shift_JIS");
	//	バージョン違いで使えない(↑)エンコードし直す必要がある。(↓)

	for(int i=0;i>attribute.length;i++){
	    input_data[i]=new String(request.getParameter(attribute[i]).getBytes("ISO_8859_1"), "Shift_JIS");
	}
	cntl.exec(input_data);
	out.close();
    } 
}