%@ taglib prefix="blast" uri="/WEB-INF/blastradius.tld" %> <%@ page import="java.sql.*,javax.sql.*,javax.naming.*" %> <% String theURL = ""; String height = "500"; String width = "740"; blastradius.js.JspObject prestitial = new blastradius.js.JspObject(); java.util.Date d = new java.util.Date(); java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); try { String appId = (String)vug.actions.VUGResource.getProperty("applicationId"); blastradius.cache.Cache cache = vug.content.VUGCache.getCache("getPrestitial"); blastradius.js.JspObject result = (blastradius.js.JspObject) cache.get("appId"); if(result != null) { theURL = result.getString("theURL"); height = result.getString("height"); width = result.getString("width"); d = df.parse(result.getString("liveDate")); } else { Connection conn = null; ResultSet rs = null; Statement stmt = null; try { Context env = (Context) new InitialContext().lookup("java:comp/env"); DataSource pool = (DataSource)env.lookup("jdbc/vugames_oracle"); conn = pool.getConnection(); stmt = conn.createStatement(); String sqlStr = "select flashurl, height, width, livedate from prestitial where APPLICATONID = 3 and active = 1"; rs = stmt.executeQuery(sqlStr); while(rs.next()) { theURL = rs.getString("FLASHURL"); prestitial.put("theURL", theURL); height = rs.getString("height"); prestitial.put("height", height); width = rs.getString("width"); prestitial.put("width", width); d = df.parse(rs.getString("liveDate")); prestitial.put("liveDate", (d.getYear()+1900)+ "-" + (d.getMonth()+1) + "-" + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds()); } } catch (Exception e) { System.out.println("Index.jsp Problem " + e.toString()); } finally { if (conn!=null) { try { conn.close(); } catch (Exception e) {} } if (rs!=null) { try { rs.close(); } catch (Exception e) {} } if (stmt!=null) { try { stmt.close(); } catch (Exception e) {} } } cache.put("appId", prestitial, vug.content.VUGCache.getTime("getPrestitial")); } } catch (Exception e) { // if there is an error go to the home page. pageContext.forward("home.do"); } if ( theURL.equals("") ) { pageContext.forward("home.do"); } if (d.after(new java.util.Date())) { pageContext.forward("home.do"); } %>
|
|