Pessoal, alguém pode me explicar por que não consigo exibir este JOptionPane? O listener está configurado no web.xml:
package com.posjava.unitri.control;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.swing.JOptionPane;
public class ListenerTempoAplicacao implements ServletContextListener {
public static final String tempoInicial = "tempoIinicial";
@Override
public void contextInitialized(ServletContextEvent event) {
event.getServletContext().setAttribute(tempoInicial, System.currentTimeMillis());
}
public void contextDestroyed(ServletContextEvent event){
long tempoFim = System.currentTimeMillis();
long tempoInicio = (Long) event.getServletContext().getAttribute(tempoInicial);
long tempoTotal = (tempoFim - tempoInicio)/1000;
JOptionPane.showMessageDialog(null, "A aplicação ficou no ar por " + tempoTotal + " segundos!");
event.getServletContext().removeAttribute(tempoInicial);
}
}