# Managing links - overview

There are several ways to manage links within and between Web projects and external files. You can manage the links manually or you can set preferences to control how links are managed when you edit, test, or publish a project. You can specify

- how default link paths are set
- how links to external files are handled when they are inserted
- how links are handled when you save a file
- how links to a file are handled when the file is renamed.

To specify the default settings for all Web projects, select Window > Preferences > Web Tools > Links

The initial default settings are as follows:

- When you save a file containing link paths beginning with file://, the path is set relative to the document's local directory.

  You can change the default preference so that link paths are relative to the linked document's root directory. The document root directory (or context root) is the top-level directory of the Web site when it is deployed to a server.

- When you insert links to inaccessible files outside of your project (such as those in a project that are not in the same EAR), other than HTML or JSP files, you can specify how you want those linked files to be handled so that all of the files are available when you publish your project. You can choose to have the files copied to the project, or change links to the files to a default relative link path.

  You can also turn off either or both of these preferences.

- When you save a file, externally linked files (other than HTML and JSPs) are copied into the current project.

  You can change the default so that instead of having the files copied locally when you save your project, a broken links dialog is displayed.

- When you move or rename a file, links to the file are automatically updated to reflect the change, and a confirmation window is displayed before any automatic changes are made. In addition, any links within a file that are moved are also updated.

  You can turn off either or both of these preferences.

Important: Files must be in the WebContent folder for link validation to work correctly; links between files that are not in the WebContent folder will be deemed external or broken.

Broken links are displayed in the Problems list and are indicated by the icon in the first column.

When you select a preference that automatically copies files to your directory or displays the Broken links dialog, files that cannot contain links are copied or listed in the Broken links dialog. (One exception is CSS files, which can contain links to HTML and JSP files.)

HTML and JSP files are not automatically copied because they are likely to contain links to other external files. Copying them to a local directory likely would create more broken links.

If you need to link to other HTML files or JSP file outside of your project, you can reference them by mapping a drive to the system and directory where they are stored. Then set your Default Link Path preference to Relative to the Document Root Directory. This way you can reference files that are already on your Web server without having the files locally.

Related concepts
Links view

Related tasks
Refreshing the Links view
Fixing broken links using the Fixup link references wizard

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.