[Struts]Problème Création Plugin Struts
Bonjour tout le monde !
Voici le code java de mon plugin
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
package eyrolles;
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 EyrollesPlugin implements PlugIn{
public static final String PROPERTIES = "PROPERTIES";
public void init(ActionServlet servlet,
ApplicationConfig applicationConfig)
throws javax.servlet.ServletException {
System.err.println("---->Le plug-in demarre<----");
Properties properties = new Properties();
try {
File file = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\monAppli\\WEB-INF\\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 " + rProperties.getProperty("LDAP"));
}
catch (FileNotFoundException fnfe){
throw new ServletException(fnfe.getMessage());
}
catch (IOException ioe){
throw new ServletException(ioe.getMessage());
}
}
public void destroy(){
System.err.println("---->Le plug-in s'arrete<----");
}
} |
Mon problème est une erreur sur l'objet ApplicationConfig qui n'est pas reconnu par le compilateur ! J'utilise un tomcat 5 et un struts 1.2.7. Est ce un soucis de version ou autre chose ?
[Modéré par Didier] : ajout de tag dans le titre + ajout de balises code - Les règles du forum Java