
 | 

Using Web Site Rules to generate URLs to JSPs
Tip submitted by
Jurgen Van De Moere


Level: Intermediate
Works with: Notes/Domino 6
Updated: 02/03/2003

Related link:
More Tips from LDD | 
 | 
When you create links to JavaServer Pages (JSPs) that are stored in Domino databases, you must omit the NSF file extension in the URL. But it's easy to forget to omit the file extension, so why not avoid this problem use Web site rules.
Suppose you have a Web site http://www.domain.tld which is hosted in a db at http://www.domain.tld/dir1/dir2/db.nsf.
Normally, you build links as follows:
Domino URL: http://www.domain.tld/dir1/dir2/db.nsf/xyz?command
JSP (omit the nsf): http://www.domain.tld/dir1/dir2/db/xyz.jsp
Let's automate this and shorten the URLs at the same time by creating two simple Web site rules.
- Open your Domino Directory in your Lotus Notes client.
- Go to the Servers - Internet Sites view.
- Open a Web site document, then click the Web Site button, then click Create Rule from the menu.
- In the Web Site Rule document, select Substitution in the Type of rule field.
- In the Incoming URL pattern field, enter:
/*
- In the Replacement pattern field, enter:
/dir1/dir2/db.nsf/*
Note that the path reflects the previous example, so should be changed to reflect your environment.
- Save and close the document.
- Repeat Steps 3 to 7 for a second Web Site Rule document, enter the following:
- In the Type of rule field, select Substitution.
- In the Incoming URL pattern field, enter:
/*.jsp
- In the Replacement pattern field, enter
/dir1/dir2/db/*.jsp
Note that the directory path reflects the previous example, so should be changed to reflect your environment.
- Close the directory.
With these rules, instead of creating a link with a long URL like:
http://www.domain.tld/dir1/dir2/db.nsf/xyz?command
you can use nice short URL:
http://www.domain.tld/xyz?command
And for JSPs, instead of using:
http://www.domain.tld/dir1/dir2/db/xyz.jsp
you can use:
http://www.domain.tld/xyz.jsp
That's all! No more differentiating between building links to Domino design elements and to JSPs. And all your URLs are short and easier to remember.
SUBMIT YOUR TIPS! |
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about any Lotus product. The most important thing is that your tip be interesting, useful, or handy. And be sure to include complete information about how your tip works. For ideas, take a look at our tip archives. If we publish your tip, we'll send you the IBM Redbooks Lotus Collection on CD. |
|
| 
 |