16.10.2015 Views

Getting Started with WebSphere Application Server

Create successful ePaper yourself

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

Chapter 3 – Development <strong>with</strong> Community Edition 59<br />

4. To run the servlet, right-click on the window and choose Run As -> Run on<br />

<strong>Server</strong>. Your servlet should now run as shown in Figure 3.18 below.<br />

Figure 3.18 - Running the servlet<br />

5. If you go to WebContent/WEB-INF, and open the file web.xml, you should<br />

see your Servlet definition as shown below.<br />

<br />

<br />

HelloWorld<br />

HelloWorld<br />

servlets.HelloWorld<br />

<br />

<br />

HelloWorld<br />

/HelloWorld<br />

<br />

3.6 JSPs<br />

Java<strong>Server</strong> Pages (JSPs) provide a high-level abstraction to servlets. To create a JSP file,<br />

follow this procedure:<br />

1. Right-click your project in the Project Explorer and choose New -> JSP<br />

2. For the file name use jsppage.jsp and click Finish. An editor will open <strong>with</strong> a<br />

template where you can start adding your JSP code.<br />

3. Inside the body section enter:<br />

<br />

4. Right-click on the window and choose Save. Right-click again and choose Run<br />

as -> Run on server<br />

5. Select your server and click Finish. You should now see your JSP running as<br />

shown in Figure 3.19.

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

Saved successfully!

Ooh no, something went wrong!