blob: 57cf2d47aa063e487b045c12dce065fd5ac3831b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2006" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Adding and removing JSP templates" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta content="JSP templates, adding, removing, templates, JSP" name="DC.subject" />
<meta content="JSP templates, adding, removing, templates, JSP" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="csrcedt004.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt027.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt024.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt029.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt000.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tsrcedt028" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Adding and removing JSP templates</title>
</head>
<body id="tsrcedt028"><a name="tsrcedt028"><!-- --></a>
<h1 class="topictitle1">Adding and removing JSP templates</h1>
<div><p>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.</p>
<div class="section"> <p>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 <span class="uicontrol">Pattern</span> 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.</p>
<p>To add a new JSP template,
complete the following steps:</p>
</div>
<ol>
<li class="stepexpand"><span>From the <span class="uicontrol">Window</span> menu, select <span class="uicontrol">Preferences</span>.</span>
</li>
<li class="stepexpand"><span>In the Preferences page, select <span class="menucascade"><span class="uicontrol">Web and
XML</span> &gt; <span class="uicontrol">JSP Files</span> &gt; <span class="uicontrol">JSP Templates</span>
</span>.</span></li>
<li class="stepexpand"><span>Click <span class="uicontrol">New</span>. </span></li>
<li class="stepexpand"><span>Enter the new template name (a text string) and a brief description
of the template.</span></li>
<li class="stepexpand"><span>Using the <span class="uicontrol">Context</span> drop-down list, specify
the context in which the template is available in the proposal list when content
assist is requested.</span></li>
<li class="stepexpand"><span>In the <span class="uicontrol">Pattern</span> field, enter the appropriate
tags, attributes, or attribute values (the content of the template) to be
inserted by content assist.</span></li>
<li class="stepexpand"><span>If you want to insert a variable, click the <span class="uicontrol">Variable</span> button
and select the variable to be inserted.</span> For example, the <var class="varname">word_selection</var> variable
indicates the word that is selected at the beginning of template insertion,
and the <var class="varname">cursor</var> variable determines where the cursor will
be after the template is inserted in the HTML document.</li>
<li class="stepexpand"><span>Click <span class="uicontrol">OK</span> to save the new template.</span>
</li>
</ol>
<div class="section"><p>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.</p>
<p>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.</p>
</div>
</div>
<div><div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="csrcedt004.html" title="Structured text editor is any of several text editors that you can use to edit various markup languages such as HTML, JavaScript, or XML.">Structured text editors for markup
languages</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="tsrcedt027.html" title="Content assist provides 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.">Adding and removing markup language
templates - overview</a></div>
<div><a href="tsrcedt024.html" title="HTML 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.">Adding and removing HTML templates</a></div>
<div><a href="tsrcedt029.html" title="XML content assist provides a comment template, a chunk of predefined code that you can insert into a file. You can use the default template as provided, customize that template, or create your own templates.">Adding and removing XML templates</a></div>
<div><a href="tsrcedt000.html" title="You can edit text coded in markup languages with a structured text editor. This is a generic term for several editors that you can use to edit any of several markup languages, such as HTML.">Editing text coded in markup languages
- overview</a></div>
</div>
</div>
</body>
</html>