Photo With Link In The Java

Photo with link in the Java.

Prepare the following form with the:
1) Name field, which is Editable Listbox with a list of emploiees names:
2) $$QuerySaveAgent field which starts the PhotoLinkAget on save action
The Java code of this agent is below:

| import java.io.*; |
| import lotus.notes.*; |
| |
| public class PhotoLinkAgent extends AgentBase { |
| |
| public void NotesMain() { |
| |
| try { |
| Session session = getSession(); |
| AgentContext ac = session.getAgentContext(); |
| Document doc = ac.getDocumentContext(); |
| |
| |
| // Collect information from the current document |
| String msg = doc.getItemValueString("Name"); |
| // Substitute emty space " " with " , " and change position |
| of First and Last names |
| int len = msg.length(); |
| int k = msg.indexOf(" "); |
| String str = " , "; |
| String msg01 = msg.substring(0, k); |
| String msg02 = msg.substring(k+1, len); |
| String msg1 = msg02 + str + msg01; |
| |
| // Print HTML and JavaScript |
| PrintWriter out = getAgentOutput(); |
| String js = "\"alert('This is " + msg + " photo')\""; |
| out.println("<body onLoad=" + js + " bgcolor=\"EAEAF4\">"); |
| out.println("<a href |
| = 'http://www.desl.lv/names.nsf/People/" + msg1 + |
| "?OpenDocument'><IMG SRC = '/TipsByPavels.nsf/" + msg + |
| ".jpg?OpenImageResource'></a>"); |
| out.println("<h1>" + msg + "</h1>"); |
| out.println("</body>"); |
| } catch (Exception e) { |
| e.printStackTrace(); |
| } |
| } |
| } |



The red part of the program substitutes blanck space " " between First and
Last names (collected from the Name field) with " , " and change their
positions (as it is in the Person form of the names.nsf database).
3) All the employees photos must be saved in Resources/Images of the same
database with names as First Last.jpg.
When opened the form in web will look like this:

(Embedded image moved to file: pic05885.pcx)
Selecting an employee and clicking on the Submit button the next
code-generated form is presented:

(Embedded image moved to file: pic09494.pcx)
Closing the Microsoft Internet Explorer box you have an opportunity to
click on the photo to link to the Person document of this employee in NAB
database:

(Embedded image moved to file: pic05197.pcx)

- pic05885.pcx
- pic09494.pcx
- pic05197.pcx
This was last published in November 2000

Dig Deeper on Java for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close