%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="java.util.*,java.io.*"
%>
<%
String[] monthString={"January","February","March","April","May","June","July","August","September","October","November","December"};
String htmlpage="/opa/pr/";
Calendar today=Calendar.getInstance();
int chkMonth=today.get(Calendar.MONTH);
String curMonth=today.get(Calendar.YEAR)+"/";
String errMsg="";
File existFile=null;
while(chkMonth>-1){
try{
existFile=new File(getServletContext().getRealPath(htmlpage+curMonth+monthString[chkMonth]+"/index.html"));
}catch(NullPointerException ex){
System.out.println("NullPointerException: "+ex.getMessage());
System.out.println("RealPath from context: "+getServletContext().getRealPath(htmlpage+curMonth+monthString[chkMonth]+"/index.html"));
errMsg=ex.getMessage();
break;
}
try{
if(existFile.exists()){
break;
}
}catch(Exception ex){
System.out.println("Global Exception "+ex.getMessage());
errMsg=ex.getMessage();
break;
}
--chkMonth;
}
htmlpage+=(curMonth+monthString[chkMonth]);
htmlpage+="/";
%>