Slashdot Mirror


Using J2EE and PHP together

An anonymous reader writes "There's an article in the May issue of the WebSphere Developer Technical Journal at IBM's developerWorks site on Pairing PHP with Java to meet the needs of a familiar web application scenario. The example consists of a Struts application deployed on WebSphere Application Server, which serves as the private content management tool, and a PHP 5 site to display that data to the public. Both parts of the application share a single Apache and DB2 instance."

9 of 41 comments (clear)

  1. PHP instead of JSP? by UberChuckie · · Score: 3, Interesting

    The answer to the "Why would you want to do this?" section was pretty much "because you can" and that PHP is supposed to be easier to learn vs JSP. Doesn't JSP provide the same functionality as PHP? Given the fact that you would have to know Java to do the J2EE part, I don't see how the JSP part can be a problem.

    It looked like a lot of work to get it running as well versus just dropping an EAR (or WAR) file and ask the app server to deploy it.

    1. Re:PHP instead of JSP? by Jagungal · · Score: 2, Informative

      If you know J2EE then you also should have no problems with Tapestry http://jakarta.apache.org/tapestry/ or JSF.

      PHP and JSP and the like are nothing but a parameterised buggy nightmare.

  2. Re:Java Alternative by msuzio · · Score: 2

    Slow? I hardly ever find Java slow. Is the VM slow to start up? Yes... but that really doesn't matter in most contexts where you would use it (i.e., a Web application that starts up once, then runs).

    In general, Java is very fast.

    That having been said, Perl is quite portable, and runs decently fast under something like mod_perl, where (once again) you incur the overhead of startup once, then the code runs many times.

    I wish people would stop bringing up the speed of Java, then point to applets. Very few people use applets at all these days, Flash is becoming more attractive for many of those sorts of things and is darn faster. Even Java desktop applications seem plenty zippy to me most of the time (although in some, like JBuilder, I can totally tell when garbage collection is taking place, I get freezes of the interface at times like that... something is a little wonky in how that app is written).

  3. Re:Why bother with PHP ? by Espectr0 · · Score: 2, Interesting


    Just go the whole java way - use something like tapestry:httpjakartaapacheorgtapestry Throw away the the parameter parsing and the buggy nightmare that is scripting languages imbedded in html.


    That's way too many frameworks. I just use one of them, it's called Freemarker, check it out. Lots of features, decent speed, very easy to use and great documentation. Sure puts JSP to shame. I used it on my forum software with ldap authentication (shameless plug) and it made my life easier.

  4. Re:Wha...? by FriedTurkey · · Score: 3, Interesting

    If you RTFA it isn't talking about JSP. It is about using Java in the middleware (WebSphere) and PHP in the presentation layer (Apache).

    There is actually a lot of use for this as a web developer is often someone on a seperate team as the application business layer team.

    Why should a PHP web site be rewritten in Java/JSP to use a existing Java middleware module?

  5. Re:Wha...? by dereference · · Score: 3, Informative
    If you RTFA it isn't talking about JSP. It is about using Java in the middleware (WebSphere) and PHP in the presentation layer (Apache).

    With all due respect, this is quite incorrect. If you re-RTFA carefully, you'll see:

    The example consists of a Struts application deployed on WebSphere Application Server V5.1, which serves as the private content management tool for entering information by the Catabase team. A PHP 5 public site will display the content and enable users to search for animals based on their attributes. The database shared by both components is DB2 UDB Enterprise Server Edition Version 8.2. The Web server instance for both portions is Apache 1.3.

    So yes, basically they have a Struts part (hosted by WebSphere acting only as a J2EE Web Container) for the "internal" web site, and a PHP part for the "external" web site. The only things shared are the HTTP server (which invokes the PHP or Struts modules) and the database (which is read by PHP and read/written by Struts).

    There is no "middleware" to speak of here.

  6. Sure.. by Joff_NZ · · Score: 2, Interesting

    We've been using this mix ourselves for a little while now... the main core of the application is deployed on JBoss, where all the heavy processing occurs, with scheduled jobs etc running via Quartz

    The web-based components that the users interact with are written in PHP5 - a decision that was not made based on any sort of execution speed differences that may or may not exist between PHP and JSP, but on the shorter development time we were going to have with PHP

    Whole thing works very well :-)

    --
    The revolution will not be televised. It won't be on a friggin blog either
  7. I'm doing this already by smartfart · · Score: 2, Interesting
    Well, almost. My client is purchasing a medical database application that runs on Tomcat and MySQL (save the flames, please), and I already have two projects planned that will add functionality that the vendor doesn't provide.
    1. A sign-in kiosk in the patient waiting room for new patients to input their personal information (name, address, insurance provider,reason for visit, etc.).
    2. An externally-accessible portal for the clinic's customers (they do a lot of occupational medicine) to view information regarding their employees that have been sent to the clinic for drug screens, injuries, etc.. The database vendor provides a hosted web portal for $100 per month, but it's limited in that each patient is required to have his own login, and only one patient is viewable at a time. This limits the employer's ability to view all the employee records, obviously.

    My client was already sold on the system (they reviewed three competing products), and my promises of ease-of-extensiblilty utilizing PHP was icing on the cake :-)

  8. Re:god, no! by namekuseijin · · Score: 2, Insightful

    "Java isn't interpreted."

    sorry, call it just-in-time compilation if you like, but no matter how you look at it, it's still a language (bytecodes) being translated to another language ( native ASM ) in execution-time ( execution of the JVM, that is ). That's interpretation for me, not compilation.

    "In any case, what do you propose be used for web applications?"

    How about Ocaml, Python, Scheme, Haskell or Ruby? Powerful, modular, flexible and concise languages for a powerful, modular and flexible environment like the web...

    or perhaps just wait for Links...

    --
    I don't feel like it...