Writing Facebook Applications Using Java EE
Figure 9: The myfacebookapp project with the Facebook Java libraries added
Once this is done, you finally can begin coding a basic Facebook app.
A Facebook App in Two Parts: A Servlet and a JSP
To keep things simple, this app does not use any hot web frameworks and cool design patterns. You will write a simple "Model 2" Java EE application, just a servlet and JSP page per action. If you know how to write Java web applications with Struts, Spring MVC, WebWork, Tapestry, etcetera, you will be able to take this code and apply it to your Java web framework of choice. You have to know how to walk before you can run, and you'll do the servlet and JSP walk this once.
Continuing with Eclipse, right-click the "myfacebookapp" folder, and select the "New" menu item. Out of the many choices, select "Servlet." In the "Create Servlet" dialog box, write org.myfacebookapp in the "Java package" field and AbstractFacebookServlet in the "Class name" field. Click "Finish" to continue.
Figure 10: Right-click the project folder and select New -> Servlet
Figure 11: The "Create Servlet" dialog box
Page 4 of 7