Howdy,

>How to implement notifying all online user when the record in database
has
>been changed? I am using Servlet and JSP to build a small Supply-Chain
>system running on Tomcat with MySQL.

Cool design question ;)  You probably can't do it immediately on change,
but on the next page the user loads after the change.  Here's an
approach:

- Have a Filter mapped to all requests (url-pattern /*) that polls the
DB or listens for the DB change event from another source.

- Have a servlet that displays the contents of this change, let's call
it ServletA

- When the DB changes, the filter is notified and does the following:
        - Puts a "notified" attribute with value "false" in every
incoming request
        - Gets a RequestDispatcher for ServletA and includes its
contents in the response
      - Sets the "notified" attribute to value "true" after
chain.doFilter, i.e. on the response's way back to the browser

It's just an idea, doubtless others will have a different take ;

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to