Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

Adding and removing JSP templates

JSP content assist provides several templates, or chunks of predefined code, that you can insert into a file. You can use the default templates as provided, customize the default templates, or create your own templates.

For example, you may work on a group of JSP pages that should all contain a table with a specific appearance. Create a template that contains the tags for that table, including the appropriate attributes and attribute values for each tag. (You can copy and paste the tags from a structured text editor into the template's Pattern field.) Then select the name of the template from a content assist proposal list whenever you want to insert your custom table into a JSP file.

To add a new JSP template, complete the following steps:

  1. From the Window menu, select Preferences.
  2. In the Preferences page, select Web and XML > JSP Files > JSP Templates .
  3. Click New.
  4. Enter the new template name (a text string) and a brief description of the template.
  5. Using the Context drop-down list, specify the context in which the template is available in the proposal list when content assist is requested.
  6. In the Pattern field, enter the appropriate tags, attributes, or attribute values (the content of the template) to be inserted by content assist.
  7. If you want to insert a variable, click the Variable button and select the variable to be inserted. For example, the word_selection variable indicates the word that is selected at the beginning of template insertion, and the cursor variable determines where the cursor will be after the template is inserted in the HTML document.
  8. Click OK to save the new template.

You can edit, remove, import, or export a template by using the same Preferences page. If you have modified a default template, you can restore it to its default value. You can also restore a removed template if you have not exited from the workbench since it was removed.

If you have a template that you do not want to remove but you no longer want the template to appear in the content assist list, go to the Templates preferences page and uncheck its check box.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire