Hello
I'm getting the following compile error with my
JSP page:
Note: sun.tools.javac.Main has been deprecated.
\ServletExec\Servlets\pagecompile\_PropertiesJSP_xjsp.java:14: The method void jspInit() declared in class pagecompile._PropertiesJSP_xjsp cannot override the method of the same signature declared in class com.newatlanta.servletexec.JSP10HttpJspPage. Their throws clauses are incompatible.
public void jspInit() throws java.io.IOException {
^
1 error, 1 warning
My code is:
<%!
private java.util.Properties props;
public void jspInit() throws java.io.IOException {
// private Properties props;
ServletConfig config = getServletConfig();
ServletContext context = config.getServletContext();
props = (java.util.Properties)context.getAttribute("props");
if (props == null){
loadProps();
props = new java.util.Properties();
}
}
public void loadProps() throws java.io.IOException {
props = new java.util.Properties();
try {
props.load(this.getClass().getResourceAsStream("/project3.properties"));
} catch (IOException ioe) {
System.out.println("Can't load the properties file");
ioe.printStackTrace();
} catch (Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
}
}
%>
<html> <html>
<head>
<title>Project Information Page</title>
</head>
<center><body>
<h3>The Project Information Page is a JSP page that displays elements in a properties file</h3>
<table border cellspacing=0 cellpadding=4>
<tr><td><b>Author</b></td>
<td><%= out.println(props.getProperty("author")) %></td></tr>
<tr><td><b>Email</b></td>
<td><%= out.println(props.getProperty("Email")) %></td></tr>
<tr><td><b>Course</b></td>
<td><%= out.println(props.getProperty("Course")) %></td></tr>
<tr><td><b>Schedule</b></td>
<td><%= out.println(props.getProperty("Schedule")) %></td></tr>
<tr><td><b>Instructor</b></td>
<td><%= out.println(props.getProperty("Instructor")) %></td></tr>
<tr><td><b>Description</b></td>
<td><%= out.println(props.getProperty("Description")) %></td></tr>
</table></center></body>
</html>
}
Thanks