29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In this example, we will be building a page called AddNewItemProcess.jsp. The<br />

entry point into this process is an HTML page called AddNewItem.html. This<br />

page basically consists of a form with input fields. The fields are used to collect<br />

data about the new item that is to be added. When the user clicks the Submit<br />

button, AddNewItemProcess.jsp is called to take those fields and add a record to<br />

the database based on them. The basic flow of this process is shown in<br />

Figure 8-9.<br />

*<br />

Add Item<br />

Required fields are indicated by an asterisk<br />

Item Number<br />

Item Name<br />

Description<br />

Quantity<br />

Price (US)<br />

Featured Item?<br />

Reset<br />

Submit<br />

AddNewItem.html<br />

Figure 8-9 Add new item process<br />

get request parameters<br />

validate item #<br />

Look for duplicate items in db<br />

If this item is a featured item, unmark<br />

others<br />

Add item to the database<br />

AddNewItemProcess.jsp<br />

Creating a new JSP<br />

To create a new JSP:<br />

1. From the Web perspective and Project Navigator view, select the folder where<br />

you want to put the JSP. This can be directly in the Web Content folder of the<br />

Web project or in a user-defined folder under it. In this case, we will select the<br />

Web Content/administration folder.<br />

2. Right-click the folder and select New -> JSP file. A wizard will begin.<br />

3. On the first page, set the File Name field to AddNewItemProcess.<br />

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

Database

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

Saved successfully!

Ooh no, something went wrong!