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.

Page templates versus style sheets<br />

Though style sheets have not been discussed as of yet (see 5.1.9, “Working with<br />

style sheets” on page 120), there may be some confusion about page templates<br />

and style sheets. Page templates are used if you wish to create a standard layout<br />

for the JSP and HTML pages in your application. For example, you may want<br />

each page in your application to have a header, a navigation menu on the left<br />

side of the page, and a footer. All of these elements can be created in a page<br />

template and then used by the pages in your application; this obviously will aid in<br />

the maintenance of your application as changes only need to be made in one<br />

area. Style sheets, on the other hand, are used by page templates (or JSP and<br />

HTML pages) to set fonts, colors, table formatting, etc. Again, like page<br />

templates, maintenance is done in one area, which will save time.<br />

A page template can act as a style sheet if you set your styles within the page<br />

template. Since the template is used by every page in your site, any settings in<br />

the page template will be reflected in the corresponding pages. That said, this is<br />

not the recommended development scenario. It is best to keep the page template<br />

and style sheet separate.<br />

Creating a page template<br />

To create a page template that you can use in Page Designer, follow these steps:<br />

1. Create a new dynamic Web project:<br />

a. Choose File -> New -> Project.<br />

b. Select Web -> Dynamic Web Project and click Next.<br />

c. Enter a Project name and click Finish.<br />

2. Create a JSP, an HTML, or an XHTML file. If you are creating a JSP file, follow<br />

these steps:<br />

a. Select the newly created project in the Project Navigator.<br />

b. Choose File -> New -> JSP File. The New JSP File wizard appears.<br />

c. Fill in the Folder and the File Name fields.<br />

d. Select HTML as the Markup language and None as the Model.<br />

e. Click Finish. The new page opens in Page Designer.<br />

3. If you are creating an HTML or XHML file instead of a JSP file, follow these<br />

steps:<br />

a. Select the newly created project in the Project Navigator.<br />

b. Choose File -> New -> HTML/XHTML File. The New HTML File wizard<br />

appears.<br />

c. Fill in the Folder and the File Name fields.<br />

Chapter 5. Working with HTML 111

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

Saved successfully!

Ooh no, something went wrong!