Home > Domino Tips > Developer > Java > Photo With Link In The Java
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

JAVA

Photo With Link In The Java


Pavels Proskurovskis
05.02.2000
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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

Code

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

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Java
Java code inserts data from Notes documents into a SQL table
Java code shortens strings in a SQL table
How to execute a stored procedure in Lotus Notes Domino using Java
How to return an HTML representation of a Lotus Notes rich-text field
Shrink Lotus Notes databases with many attachments
Converting Lotus Notes Domino Web pages to PDF files with a Java agent
A bevy of Notes/Domino development tips
Converting Web pages to images using Java
Creating Microsoft Word documents from Lotus Notes
FAQ: Java for Lotus Notes and Domino

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts