tags:

views:

164

answers:

2

I'm going to start a new project with instant message support.

I find that there is no good long polling solution in PHP, but there is some good ones in J2EE.

I'm wondering if I can integrate PHP and J2EE to get the function? Or should I just use J2EE instead of PHP?

Thanks.

+1  A: 

Keeping the number of development platforms to a minimum is always a good idea. It will keep deployment requirements low, gives less operational complexity and gives the best possible integration.

If you want to replace PHP by Java, you have lots of frameworks you can use to replace PHP. A good option would be the Stripes framework it’s an easy to use MVC framework that does not need much configuration.

An other very workable solution would be using Java in the backend for filling the database. And use PHP in the frond-end and use the database to retrieve data. This way the integration is limited to a shared database.

If you would like to have a direct integration between PHP and Java, things start to get more complex. It could be implemented by either web services or the faster php-java-bridge. But I don’t think you need this and if you do, I would seriously consider migrating the whole project to Java.

For an implementation example of the php-java-bridge see: How to share session between Java and PHP

Kdeveloper
A: 

You CAN build your application with PHP together with J2EE. The PHP is to generate HTML, and J2EE supports Comet.

Actually, Facebook generates HTML with Apache server. I bet Facebook web pages are written in PHP. And the Comet server of chatting is written in ErLang hosted in Mochiweb. Two languages & servers works fine together.

The decision is up to your own preference.

Morgan Cheng