blob: 09647fb458b183ca269f8a8025a80ffe48d2418d [file] [log] [blame]
kprice9c922d82006-08-30 22:07:19 +00001<?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">
2<html lang="en-us" xml:lang="en-us">
syeshin17ed4a62005-07-25 17:10:24 +00003<head>
kprice9c922d82006-08-30 22:07:19 +00004<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
kprice02ec4b02008-05-14 23:26:58 +00005<meta name="copyright" content="Copyright (c) 2000, 2008 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" />
6<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
kprice9c922d82006-08-30 22:07:19 +00007<meta content="public" name="security" />
8<meta content="index,follow" name="Robots" />
9<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))' />
10<meta content="task" name="DC.Type" />
11<meta name="DC.Title" content="Adding and removing JSP templates" />
12<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." />
13<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." />
kprice02ec4b02008-05-14 23:26:58 +000014<meta content="JSP files, templates, JSP pages" name="DC.subject" />
15<meta content="JSP files, templates, JSP pages" name="keywords" />
kprice9c922d82006-08-30 22:07:19 +000016<meta scheme="URI" name="DC.Relation" content="csrcedt004.html" />
17<meta scheme="URI" name="DC.Relation" content="tsrcedt027.html" />
18<meta scheme="URI" name="DC.Relation" content="tsrcedt024.html" />
19<meta scheme="URI" name="DC.Relation" content="tsrcedt029.html" />
20<meta scheme="URI" name="DC.Relation" content="tsrcedt000.html" />
21<meta content="XHTML" name="DC.Format" />
22<meta content="tsrcedt028" name="DC.Identifier" />
23<meta content="en-us" name="DC.Language" />
24<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
syeshin17ed4a62005-07-25 17:10:24 +000025<title>Adding and removing JSP templates</title>
syeshin379dd3e2005-08-26 04:28:44 +000026</head>
syeshin17ed4a62005-07-25 17:10:24 +000027<body id="tsrcedt028"><a name="tsrcedt028"><!-- --></a>
28
kprice9c922d82006-08-30 22:07:19 +000029
syeshin17ed4a62005-07-25 17:10:24 +000030<h1 class="topictitle1">Adding and removing JSP templates</h1>
kprice9c922d82006-08-30 22:07:19 +000031
32
33
syeshin17ed4a62005-07-25 17:10:24 +000034<div><p>JSP content assist provides several templates, or chunks of predefined
35code, that you can insert into a file. You can use the default templates as
kprice9c922d82006-08-30 22:07:19 +000036provided, customize the default templates, or create your own templates.</p>
37
38<div class="section"> <p>For example, you may work on a group of JSP pages that should
39all contain a table with a specific appearance. Create a template that contains
syeshin17ed4a62005-07-25 17:10:24 +000040the tags for that table, including the appropriate attributes and attribute
41values for each tag. (You can copy and paste the tags from a structured text
kprice9c922d82006-08-30 22:07:19 +000042editor into the template's <span class="uicontrol">Pattern</span> field.) Then select
syeshin17ed4a62005-07-25 17:10:24 +000043the name of the template from a content assist proposal list whenever you
44want to insert your custom table into a JSP file.</p>
45<p>To add a new JSP template,
46complete the following steps:</p>
47 </div>
kprice9c922d82006-08-30 22:07:19 +000048
49<ol>
50<li class="stepexpand"><span>From the <span class="uicontrol">Window</span> menu, select <span class="uicontrol">Preferences</span>.</span>
51</li>
52
53<li class="stepexpand"><span>In the Preferences page, select <span class="menucascade"><span class="uicontrol">Web and
54XML</span> &gt; <span class="uicontrol">JSP Files</span> &gt; <span class="uicontrol">JSP Templates</span>
55</span>.</span></li>
56
57<li class="stepexpand"><span>Click <span class="uicontrol">New</span>. </span></li>
58
59<li class="stepexpand"><span>Enter the new template name (a text string) and a brief description
syeshin17ed4a62005-07-25 17:10:24 +000060of the template.</span></li>
kprice9c922d82006-08-30 22:07:19 +000061
62<li class="stepexpand"><span>Using the <span class="uicontrol">Context</span> drop-down list, specify
syeshin17ed4a62005-07-25 17:10:24 +000063the context in which the template is available in the proposal list when content
64assist is requested.</span></li>
kprice9c922d82006-08-30 22:07:19 +000065
66<li class="stepexpand"><span>In the <span class="uicontrol">Pattern</span> field, enter the appropriate
syeshin17ed4a62005-07-25 17:10:24 +000067tags, attributes, or attribute values (the content of the template) to be
68inserted by content assist.</span></li>
kprice9c922d82006-08-30 22:07:19 +000069
70<li class="stepexpand"><span>If you want to insert a variable, click the <span class="uicontrol">Variable</span> button
syeshin17ed4a62005-07-25 17:10:24 +000071and select the variable to be inserted.</span> For example, the <var class="varname">word_selection</var> variable
72indicates the word that is selected at the beginning of template insertion,
73and the <var class="varname">cursor</var> variable determines where the cursor will
74be after the template is inserted in the HTML document.</li>
kprice9c922d82006-08-30 22:07:19 +000075
76<li class="stepexpand"><span>Click <span class="uicontrol">OK</span> to save the new template.</span>
77</li>
78
syeshin17ed4a62005-07-25 17:10:24 +000079</ol>
kprice9c922d82006-08-30 22:07:19 +000080
81<div class="section"><p>You can edit, remove, import, or export a template by using the
syeshin17ed4a62005-07-25 17:10:24 +000082same Preferences page. If you have modified a default template, you can restore
83it to its default value. You can also restore a removed template if you have
84not exited from the workbench since it was removed.</p>
85<p>If you have a template
86that you do not want to remove but you no longer want the template to appear
87in the content assist list, go to the Templates preferences page and uncheck
88its check box.</p>
89</div>
kprice9c922d82006-08-30 22:07:19 +000090
syeshin17ed4a62005-07-25 17:10:24 +000091</div>
kprice9c922d82006-08-30 22:07:19 +000092
93<div><div class="relconcepts"><strong>Related concepts</strong><br />
94<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
95languages</a></div>
syeshinaaa21932005-09-22 17:13:22 +000096</div>
kprice9c922d82006-08-30 22:07:19 +000097<div class="reltasks"><strong>Related tasks</strong><br />
98<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
99templates - overview</a></div>
100<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>
101<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>
102<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
103- overview</a></div>
104</div>
105</div>
106
syeshin17ed4a62005-07-25 17:10:24 +0000107</body>
108</html>