@PostConstruct public void init() { itemSetData = new ArrayList<ItemSetDisplay>(); curr = null; try { champId = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id"); if (FacesContext.getCurrentInstance() .getExternalContext() .getRequestParameterMap() .get("mode") != null) { gameMode = FacesContext.getCurrentInstance() .getExternalContext() .getRequestParameterMap() .get("mode"); } else { gameMode = "custom"; } // create our mysql database connection Class.forName(GlobalConfig.DB_DRIVER); Connection conn = DriverManager.getConnection( GlobalConfig.DB_URL, GlobalConfig.DB_USERNAME, GlobalConfig.DB_PASSWORD); String query = "SELECT * FROM champions WHERE ID=?"; PreparedStatement st = conn.prepareStatement(query); st.setString(1, champId); ResultSet rs = st.executeQuery(); // iterate through the java resultset while (rs.next()) { curr = new Champion(); curr.setId(rs.getInt("ID")); curr.setName(rs.getString("NAME")); curr.setTitle(rs.getString("TITLE")); String image = "http://ddragon.leagueoflegends.com/cdn/5.16.1/img/champion/" + rs.getString("KEYID") + ".png"; curr.setImage(image); String splash = "http://ddragon.leagueoflegends.com/cdn/img/champion/splash/" + rs.getString("KEYID") + "_0.jpg"; curr.setSplash(splash); String loading = "http://ddragon.leagueoflegends.com/cdn/img/champion/loading/" + rs.getString("KEYID") + "_0.jpg"; curr.setLoading(loading); } rs.close(); st.close(); conn.close(); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); } }