PROGRAMMING DOMINO FOR WEB APPLICATIONS


Web agents
Example

Agents cannot run in a browser. They can be activated from a browser but run on the Domino server containing the agent.

Setting up a Web agent

Using the Agent Properties box, do the following:


Activating a Web agent

You can activate agents from a browser in two ways:


The name of a hidden agent (for example, if the trigger is "Agent list selection") must include the parentheses when RunAgent or ToolsRunMacro launches the agent. The parentheses are optional when the OpenAgent URL command launches the agent. The OpenAgent URL requires conversion of special characters for Web use; for example, a space must be specified as + (plus sign) or %20.

Two form events work for Web processing:


To prevent the document from being saved, the document must contain a text field named SaveOptions with "0" as its value.

Note The SaveOptions field must be an existing field, the value of which the Web agent changes to "0". If the Web agent creates this field, the document will be saved regardless of the value.

LotusScript and Java in Web agents

A Web agent can be written in LotusScript or Java, as well as formula or simple actions.

An agent is the only context in which a Web application can use LotusScript. Anything that runs in the browser, such as an action, hotspot action, hotspot button, or event, cannot contain LotusScript. LotusScript agents activated from the Web cannot use any of the classes NotesTimer, NotesUIDatabase, NotesUIDocument, NotesUIView, or NotesUIWorkspace.

You can write HTML to the browser by putting it in print statements. Domino accumulates print statements and creates a page with their contents after the agent runs.

To display a new page after an agent runs, put one print statement at the end of the code containing the page's URL in brackets. You can start the URL with a slash and the name of the database to designate an element in the current database.

In Java, you must get a PrintWriter object with AgentBase.getAgentOutput and use this object to write to the browser.

The available context depends on how the agent is started:


The OpenAgent URL command passes arguments at the end of the URL string delineated by ampersands. For example:
In LotusScript and Java agents, you can get the arguments by parsing the Query_String item in the document returned by DocumentContext or getDocumentContext. Query_String contains the entire URL command that started the agent.

Example
See Also