From the Archives: @DbName workaround for Web Clients - CGI
Category Show-n-Tell ThursdayOk, I blew it last week and didn't do a Show-n-Tell Thursday posting. This week I've been so busy I haven't had time to do one either, and it looks like I'm going to be just as or more so busy next week; so I decided to "pull one from the archives".
This one comes from when I was working as an instructor / courseware developer / application developer / systems administrator / webmaster for a (now defunct) company called Celebra Technologies (also called CelebraTech), which grew out of (also now defunct) InfoImage, Inc.
This tip was originally published in July of 2001 as part of a series of monthly "tech tips" I wrote for CelebraTech; which means we were still in the days of R5 -long before @WebDbName became available. Even though the specific need for the tip is now handled by @WebDbName, the techniques used in the tip are still, I belive, valid today.
If you are really interested, I've included a link (below) to a copy of the original, as published, Word document.
@DbName workaround for Web Clients – CGI
It’s almost 2:00 AM, and your deadline is a little more than 6 hours away. You’re putting the “finishing touches” on your client’s new Web application. You’ve been working for 16 hours straight, stopping only for coffee, Mountain Dew, and Twinkies. You stare vacantly at your browser, which is cruelly displaying the fruits of your work: “HTTP 500 - Internal server error“. Your frustration grows as you check the URL, verifying that the extra backslash is still there.
This tip will help you with two of the most important pieces of information used in Domino web development…namely, the server name and file path for a Domino Application.
Are you frustrated with trying to get the right information back from an @DbName call in a web application? Are you sick and tired of converting back slashes to forward slashes? No problem! Don’t do it yourself. This is what CGI variables are for.
What is GGI? CGI stands for Common Gateway Interface, which is an industry standard for interfacing external applications with information servers, such as HTTP servers. CGI uses a set of pre-defined variables, and any application that is CGI-aware is also capable of recognizing and interacting with these variables. Using these, a developer can use almost any development environment to access and manipulate data on the server. Domino supports many of the major CGI variables; both by using the LotusScript documentContext property of the Session class, or (as is demonstrated in this tip) by adding these CGI variables as fields do a Domino Form.
This tip deals specifically with 2 standard CGI variables: Server_Name and Path_Info, which will return the same information as the first and second subsets from @DbName. To demonstrate this functionality, a subform was created containing 2 hidden, editable text fields. This subform is then placed on a form, and when the Domino server renders the form in the browser, it populates these Domino fields with the values from their like-named CGI counterparts. This tip has been tested on Netscape 3.0 – 4.77, and on MSIE 3.01 – 5.5.
This subform can now be placed on any form that is to be web-enabled. Because these are Domino fields, they are now accessible by any other field or code (such as client-side javascript) on the form. Adding a few CFD (Computed-For-Display) fields to the form is simple, and setting their values is simple, familiar @Formulae. The formulae for the three fields on this form are as follows:
- cgi_servername: Server_Name
- cgi_pathname: @ReplaceSubstring((@Left(Path_Info; ".nsf") + ".nsf/"); "/"; "")
- cgi_atDbName: cgi_servername +":" + cgi_pathname
When this form is now rendered on a web browser client, it appears similar to the following:
The great thing about using CGI variables is that they are 100% portable. You can move your application all over the directory structure, or from server to server, and it always works. No reconfiguring, no changing of configuration document, and no changing of hard-coded links (how many times have you committed THAT programming no-no?) is necessary. Just pop in a subform to carry the fields for the CGI variables add some computed fields to massage the data as you need, and you’re done. Make the server work for you; that’s what it’s there for.
Now, go brush your teeth, put on your DevCon pajamas (you do have a pair, don’t you?), and go to bed!
Ok, as promised, here is a link to the actual tip: DbNameWorkaroundForWebClients.doc
Hope you enjoyed this "look into the past".
-Devin
The Pridelands
Chris Byrne
Show n' Tell Thursdays


