Commit ad4e69ec authored by Michael Schimpelsberger's avatar Michael Schimpelsberger
Browse files

servlet as maven dependency

parent 9491e6df
......@@ -19,13 +19,7 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/h2-1.4.197.jar"/>
<classpathentry kind="lib" path="C:/Program Files/Apache Software Foundation/Tomcat 8.0/lib/servlet-api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
......@@ -83,6 +83,15 @@
<version>1.4.197</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat -->
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
......
package university.at.jku.ce.init;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
......@@ -9,18 +10,20 @@ public class MyAppServletContextListener implements ServletContextListener{
DBInitializerDao dao=new H2DBInitializerDao();
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// Do Nothing
public void contextInitialized(ServletContextEvent sce) {
if (!dao.isValidDatabase()) {dao.initDatabase();
System.out.println("Initializing Database");
}
else {System.out.println("No Database initialization required");}
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
if (!dao.isValidDatabase()) {dao.initDatabase();
System.out.println("Initializing Database");
}
else {System.out.println("No Database initialization required");}
public void contextDestroyed(ServletContextEvent sce) {
// TODO Auto-generated method stub
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment