Having a hard time with listeners and Netbeans for a simple JSP/Servlet test

D

dennis

I'm new to netbeans and the whole JSP world in general (i have
experience in j2me and the j2se). I basically wanted to test out the
listener functions.

I get no errors with the following code, however, i'm also not able to
'break' where i want to be able to and I have no output as I would
expect. Any suggestions/guides/leads to as how I can at least get a
break/output from MyHttpSessionListener using netbeans would be great.

MyHttpSessionListener.java
-------------------------------------------------------------
package com.maturitymodel;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;

public class MyHttpSessionListener implements HttpSessionListener
{
public void sessionCreated(HttpSessionEvent e)
{
System.err.println("Hello new session");
}
public void sessionDestroyed(HttpSessionEvent e)
{
System.err.println("ByeBye old session");
}

}

---------------------------------------------------------------------------
web.xml
--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<listener>

<listener-class>com.maturitymodel.MyHttpSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config><session-timeout>
30

</session-timeout></session-config><welcome-file-list><welcome-file>
index.jsp
</welcome-file></welcome-file-list></web-app>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top