R
RamRod
I am trying to compile a simple Struts plugin. I am using the latest
Struts download and I have struts.jar in my classpath. I am getting a
compilation error.
The error message is :
WileyPlugin.java:14: WileyPlugin is not abstract and does not override
abstract method init
(org.apache.struts.action.ActionServlet,org.apache.struts.config.ModuleConfig)
in org.apache.struts.action.PlugIn
public class WileyPlugin implements PlugIn {
^
The code is in file WileyStruts.java and is as follows:
import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ApplicationConfig;
import org.apache.struts.action.ActionServlet;
public class WileyPlugin implements PlugIn {
public static final String PROPERTIES = "PROPERTIES";
public WileyPlugin() {
}
public void init(ActionServlet servlet,
ApplicationConfig applicationConfig)
throws javax.servlet.ServletException {
System.err.println("---->The Plugin is starting<----");
Properties properties = new Properties();
try {
File file =
new File("/props.txt");
FileInputStream fis =
new FileInputStream(file);
properties.load(fis);
ServletContext context = servlet.getServletContext();
context.setAttribute(PROPERTIES, properties);
Properties rProperties = (Properties)
context.getAttribute(PROPERTIES);
System.err.println("---->Prop: LDAP " +
Properties.getProperty("LDAP"));
}
catch (FileNotFoundException fnfe) {
throw new ServletException(fnfe.getMessage());
}
catch (IOException ioe) {
throw new ServletException(ioe.getMessage());
}
}
public void destroy() {
System.err.println("---->The Plugin is stopping<----");
}
}
Any ideas ?
Thanks, Rod.
Struts download and I have struts.jar in my classpath. I am getting a
compilation error.
The error message is :
WileyPlugin.java:14: WileyPlugin is not abstract and does not override
abstract method init
(org.apache.struts.action.ActionServlet,org.apache.struts.config.ModuleConfig)
in org.apache.struts.action.PlugIn
public class WileyPlugin implements PlugIn {
^
The code is in file WileyStruts.java and is as follows:
import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ApplicationConfig;
import org.apache.struts.action.ActionServlet;
public class WileyPlugin implements PlugIn {
public static final String PROPERTIES = "PROPERTIES";
public WileyPlugin() {
}
public void init(ActionServlet servlet,
ApplicationConfig applicationConfig)
throws javax.servlet.ServletException {
System.err.println("---->The Plugin is starting<----");
Properties properties = new Properties();
try {
File file =
new File("/props.txt");
FileInputStream fis =
new FileInputStream(file);
properties.load(fis);
ServletContext context = servlet.getServletContext();
context.setAttribute(PROPERTIES, properties);
Properties rProperties = (Properties)
context.getAttribute(PROPERTIES);
System.err.println("---->Prop: LDAP " +
Properties.getProperty("LDAP"));
}
catch (FileNotFoundException fnfe) {
throw new ServletException(fnfe.getMessage());
}
catch (IOException ioe) {
throw new ServletException(ioe.getMessage());
}
}
public void destroy() {
System.err.println("---->The Plugin is stopping<----");
}
}
Any ideas ?
Thanks, Rod.