@Override
	public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{
		res.setContentType("text/html");
		Connection con = null;
		String lausend = null;
		ResultSet rs = null;
		PreparedStatement ps = null;
		Gson gson=new Gson();
		ArrayList<CreateByParty> byParty=new ArrayList<CreateByParty>();
		String partyName=req.getParameter("partei");
		String piirkond=req.getParameter("piirkond");
		boolean proceed= false;
		if(partyName != null && piirkond!=null){
			if(partyName.length()>0 && piirkond.length()>0){
				proceed=true;
			}
		}
		if(proceed){
		try{
			DriverManager.registerDriver(new AppEngineDriver());
			con = DriverManager.getConnection("jdbc:google:rdbms://valmindbyut:valimindbyut/evalimised");
			lausend="select * from Valitavad where Partei=(?) and Piirkond=(?);";
			ps=con.prepareStatement(lausend);
			ps.setString(1, partyName);
			ps.setString(2,piirkond);
			rs=ps.executeQuery();
			while(rs.next()){
				byParty.add(new CreateByParty(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getDate(4),rs.getString(5),rs.getString(6)));
			}
			String result=gson.toJson(byParty);
			res.setContentType("application/json");
		    res.setCharacterEncoding("UTF-8");
		    PrintWriter out=res.getWriter();
		    out.print(result);
		}
		
		catch(Exception e){
			throw new RuntimeException(e.getMessage(),e);
		}
		finally{
			if(con != null){
				try{
					con.close();
				}
				catch(SQLException ignore){
					System.out.println("Toimus erind "+ ignore);
				}
			}
		}		
	}
		else{
			System.out.println("Teil puuduvad vastavad parameeterid, vaadake need yle");
		}		
	}