29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.2 Studio Site Developer and tag libraries<br />

9.2.1 JSP wizard<br />

<strong>WebSphere</strong> Studio Site Developer contains serveral tools to help with the<br />

importing and consumption of tag libraries:<br />

► JSP wizard<br />

► Insert custom tag dialog<br />

► Snippets view<br />

As described in “Using a tag library in the Online Catalog sample” on page 301,<br />

the steps to using tag libraries are listed below. Notice that in addition to the<br />

steps, some of the tools above are listed. This indicates that these tools can be<br />

used to complete a step.<br />

1. Create a JSP (JSP wizard).<br />

2. Add a taglib directive to the JSP (JSP wizard or Insert custom tag dialog or<br />

Snippets view).<br />

3. Add the appropriate taglib tags to the JSP (Insert custom tag dialog).<br />

4. Insert the final JSP scriptlet and HTML code into the JSP; this step is<br />

optional.<br />

For step two, all three tools are listed. When using the JSP wizard, you can select<br />

the tag libraries that you wish to use in the JSP. If a tag library is selected, a taglib<br />

directive will be added to the JSP for that tag library. Likewise, in order to use the<br />

Insert custom tag dialog, you must first select the tag library; if a tag library is not<br />

listed, you can add it. In doing so, a taglib directive will be added to the JSP. The<br />

Snippets view simply adds a page directive. Each of these tools is described in<br />

greater detail in the following sections.<br />

When you create a JSP using the JSP wizard, you have the option of adding<br />

taglib directives. If the tag library that you want is not in the provided list, you can<br />

import a new tag library into the project and use it. The process of adding taglib<br />

directives and importing a new tag library is illustrated below. For the illustration,<br />

we have downloaded a validation tag library (validtag) from:<br />

http://coldjava.hypermart.net<br />

1. Switch to the Web perspective.<br />

2. Right-click the Web Content folder and select New -> JSP File from the<br />

context menu to start the JSP wizard.<br />

3. On the first page, specify your JSP File Name and click Next.<br />

288 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!