In the first two article on general event handling with servlets we have covered how to detect changes in the servlet context and monitoring the creation and destruction of the servlet context. In this last article of the series we will look into how to use listeners with tag libraries. If you have not seen the first two articles of this series, General Event Handling in Servlets, Part 1 and General Event Handling in Servlets, Part 2, then I would recommend that you review them before continuing
Updated 12-09-2011 at 04:16 PM by Servlet
In the last article, we started to look into the Application Events Framework for servlets and javaserver pages. We listed eight different kinds of events listeners that are related to web application life-cycle events. If you are interested, go review the post, General Event Handling in Servlets Part 1.
In that article, we looked at the first of the listeners for the initialization and destruction of servlet context and we presented an example of it’s use for a company that is constantly
Updated 12-09-2011 at 04:13 PM by Servlet
During the application life cycle, the ApplicationContext will publish a handful of events that tell interested listeners what’s going on. All of these events are all subclasses of the abstract class org.springframework.context.ApplicationEvent. A couple of these subclasses are: ContextClosedEvent—Published when the application context is closedContextRefreshedEvent—Published when the application context is initialized or refreshedRequestHandledEvent—Published within a web application
Text is a selectable user interface objects that allow the user to enter and modify text. Events associated with Text are: DefaultSelection, Modify, Verify. Different Text styles are CENTER, LEFT, MULTI, PASSWORD, SINGLE, RIGHT, READ_ONLY, WRAP. Please note that only one of the styles MULTI and SINGLE may be specified.
The following are the important constructors of Text class.
Text(Composite parent, int style)
Constructs a new instance of this class given its
In order to work with events in SWT, you create a listener specific to the event that you wish to capture. There is an interface for each listener that you can use (for example SelectionListener). There is also a class that will provide you with the event information (for example SelectionEvent). Within the listener that you create, you must implement the methods defined in the interface. Java Code: SelectionListener listener = new SelectionListener()
SelectionListener listener = new SelectionListener()