I've used Spring event mechanism successfully in propagating events from the
service layer to the web layer. Basically have your Controller implement
ApplicationListener
and in your implmentation of  ApplicationListener#onApplicationEvent carry
out the logic pertaining to the event you're going to raise in your service
layer

public void onApplicationEvent(ApplicationEvent event) {
       if (event instanceof MyServiceEvent) {
           ...
       }
}

------------------------------------------------------------------------------------

In your service layer, you create and raise the event as follows :

MyServiceEvent event = new MyServiceEvent(<event related data>);

ctx.publishEvent(event);

Here ctx is an instance of your app's application context file which you can
get in your service layer by having the service implement
ApplicationContextAware and the Spring container will automatically inject
the application contenxt.

http://www.springframework.org/docs/reference/beans.html#context-functionality-events


Hope this helps.

Sanjiv

On 7/2/07, mda <[EMAIL PROTECTED]> wrote:


Hello,

we would like to implement for the course an application with a web
interface which gets updated after certain events are received in service
layer. We are developing our application based on Appfuse2.0 w. Spring
MVC,
and we would actually like to have a list of users and their status
information listed on a web page.

The contents of the web page should be udpated after a manager on the
service layer gets updates about the users' status. How can that event be
propagated to the web layer? What is the best practice for implementing
the
observer pattern with appfuse 2.0?

Thanks for a quick answer in advance!
--
View this message in context:
http://www.nabble.com/How-to-implement-an-observer-in-the-web-layer-tf4013763s2369.html#a11398407
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to