public boolean loadJSP(String name,
String classpath,
boolean isErrorPage,
HttpServletRequest req,
HttpServletResponse res) throws JasperException, FileNotFoundException {
Class jspClass = (Class) loadedJSPs.get(name);
boolean firstTime = jspClass == null;
JspEngineContext ctxt = new JspEngineContext(this, classpath,
context, name,
isErrorPage, options,
req, res);
boolean outDated = false;
Compiler compiler = ctxt.createCompiler();
try {
outDated = compiler.compile();
} catch (FileNotFoundException ex) {
throw ex;
} catch (JasperException ex) {
throw ex;
} catch (Exception ex) {
throw new JasperException(Constants.getString("jsp.error.unable.compile"),
ex);
}
// Reload only if it's outdated
if((jspClass == null) || outDated) {
try {
jspClass = loadClass(ctxt.getFullClassName(), true);
} catch (ClassNotFoundException cex) {
throw new JasperException(Constants.getString("jsp.error.unable.load"),
cex);
}
loadedJSPs.put(name, jspClass);
}
return outDated;
}
|