How to send Messages

W4 Toolkit provides a basic 'Message box' - like mechanism to display information to the user. From every piece of code in your application you can call:

  String msg = "Something you want to send as message.";
  W4TContext.addMessage( new Message( msg ) );

Adding a message is something that happens on the server side. As there may be more than one message added in one and the same request cycle, when the WebForm is finally displayed to the user again, he reads all of them at once.

Note the essential difference between W4 Toolkit message and a message box in desktop applications: in the latter, the program flow is interrupted, usually until the user confirms by clicking some button. In the former, no interruption takes place: the message is simply added to a queue and shown to the user along with the application window he works with.

Messages are displayed in a separate browser window.

Design your own message page

A WebForm that implements the interface com.w4tMessageForm can be named in the configuration file W4T.xml in the WEB-INF/conf/ directory of the W4 Toolkit application. When rendering the main page, the library will pass all messages which have been added recently via the W4TContext.addMessage(Message) method to the setMessages(String) method of this MessageForm implementation and the latter is displayed to the the user in a separate window.

Copyright (c) 2003 by Innoopract Informationssysteme GmbH. All rights reserved.