Programming Assignment 3
Web Application Development using NetBeans

Due on Thursday March 3 before midnight


This project must be done individually. No copying is permitted. The goal of this project is to learn server-side web application development using NetBeans. More specifically, you will develop the same shopping web application from Project 2 using JavaServer Pages.


You can do this project either on your own PC/laptop or on a UTA PC that has NetBeans (most UTA PCs do). If you want to use your own PC, you would need to install both JDK Java and NetBeans.


You can get help by pushing the F1 key in NetBeans. Also Javadocs are very important. If you find a class or method that you don't know you right-click and select Show Javadoc.

The following provide more help. Use them as a reference only.

Project Requirements

You need to re-implement the web application described in Project 2 using Java Server Pages on NetBeans, instead of PHP. You should not use any PHP or JavaScript code. NetBeans provides many tool. You will only use Web application development using Java Server Pages (JSP).

From the NetBeans File menu, select New Project..., then Java Web/Web Application, then Next>, then put project3 for Project Name, then Next>, choose GlassFish V2 for Server, then Next>, check the Java Server Faces box and push Finish. You should get a Palette menu on the right, if not, choose Palette from the Window menu. Basically you drag and drop html/JSP components from the palette to the jsp file. Rename this file to buy.jsp. Finally, push Run the Main Project(F9) and see if it pops out a browser that displays this page.

You need to use a session bean to store your shopping basket and the results of the last search (see Developing Web Applications with JSP).

To create a session bean in NetBeans: right-click on your project and select New → Session Bean... Then, put an EJB name (say, Basket) and then a package name (say, my.beans). It must be a Stateful bean. You will get a file Add some attributes (say, List<String> value, for a string list). Right-click and do Fix Imports. Right-click and do Refactor → Encapsulate Fields... Back on your JSP program, from the Palette, select useBean and put ID=mybasket, class=my.beans.Basket and scope=session Then in JSP, you access the attribute value by selecting getBean from Palette, and use mybasket and value.

You may use the Java DOM API to access XML data based on DOM. Here is a DOM example. To call a web service, use the class. For example, this calls the ISBN DB and prints the result. Note that, to get the results from the Google search API for shopping in XML format you need to add &alt=atom to the URL.

What to Submit

You need to submit your buy.jsp file and your Java files in the Source Packages directory using the following form.

Submit Project #3:

Last modified: 02/24/11 by Leonidas Fegaras