Mastering Facebook application development, using PHP, RAD, was, and DB2, part 2nd

Source: Internet
Author: User
Tags db2 db2 express ibm db2 php class php and php code zend websphere application server

Use Java and PHP in parallel

Introduction: Part 2nd of this tutorial series covers the details of the Facebook application development that you started in part 1th, building a Facebook interface with existing stock brokers to enable them to manage online portfolios. Learn a way to split the functionality of an application into PHP and Java components, and use the Spring framework to apply a standard MVC architecture to java™ code.

Before you start

About this series

This series of tutorials takes you step-by-step through the development of a full-featured Facebook application with the tools of WebSphere application Server, rational Rational application Developer, Zend Core for IBM, PHP 5, and DB2. You will use Java and PHP 5 to write part of the code separately. Show an existing stockbroker company and you will add a Facebook interface to their online portfolio management system.

About this tutorial

In part 1th, we introduced you to the installation of Facebook and various tools, including the IBM Rational Application Development environment, Zend Core for IBM and its own Apache 2 and IBM DB2 EXPRESS-C databases to and IBM WebSphere application Server. Then you learn more about the mechanisms that Facebook's integration point--facebook provides to integrate applications into social networks and start some backbone development. You have created and configured the application on Facebook, created a test index.php for the Callback URL, set up the DB2 database, created some underlying data tables, and added the sample data to the datasheet.

In this tutorial (part 2nd of this series), you will set up a rational rational application Developer project to drive Java development, configuring a J in the IBM WebSphere application Server The NDI connection pool DB2 The data source and uses the Spring schema to apply an MVC structure to Java code to impose the structure on JDBC access. You will then write some common purpose PHP classes that will allow you to apply the same MVC structure to your PHP code and inject the attributes into the class example. You will write a common purpose Db2datasource PHP class for connecting to DB2, and use Mod_rewite and mod_proxy to make PHP and Java appear to exist in the same URL. This tutorial will make Java and PHP world as integrated as possible, because it is one of the barriers that prevents PHP and Java developers from integrating, often in different contexts and different ways of looking at the world. These two languages can coexist well in the same application (and the same team) and have a high degree of abstraction and clear structure.


Regardless of the level of development and experience, this tutorial is right for you as long as you want to apply Java, PHP, or a combination of both to write your Facebook application. This article is for PHP developers who want to learn how to use the Spring architecture to build Java EE applications, and how to apply an object-oriented architecture to their PHP applications; This article is also suitable for those who want to start using PHP and may be interested in PHP Added to a Java developer in an existing Java enterprise.

Before continuing with the 2nd part of the study, you should first read the Master Facebook application development, part 1th

Add Java next to PHP

In the 1th part, you have already run the PHP side of the application. Now you'll create content on the side of Java--using the popular spring architecture to create a rational rational application developer project and Web application. You will then write a PHP class that enables you to apply the same MVC pattern in PHP to Java and use Mod_rewrite and mod_proxy to create a reverse proxy from Apache to IBM WebSphere, so you can use the same Facebo OK Callback URLs are used for PHP and Java servers. Then, you will assign the request to PHP or Java based on the request URI using the. htaccess file. A common structure between your Java and PHP servers will make it easier to integrate and enable you (or your team) to apply more appropriate technology to each Facebook application, and the use of proxy and. Htaccess will decouple the front-end and backend.

Set up rational rational application Developer Project

Follow the steps below to set up a project in rational rational application developer:

From the Start menu, open rational Rational application developer:start > All Programs > IBM Software Development Platform > IBM Rational application Developer > IBM Rational Application Developer.

Create a new Java project (File > New > Project), select Dynamic Web Project as the project type, and WebSphere application Server v6.1 as the target run time.
Make sure that Project Facets Dynamic Web Module, Java, Jstl, and WebSphere Web Facets are selected.

Sets the context root for Facebook-stock-demo, and the content directory defaults to the Webcontent,java source code directory as src. The rational Rational application developer will then create a standard Web application project for you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.