Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Java Servlets vs. PHP

Started by _Danneman_ Jan 11, 2003 at 10:55 PM 6 replies 2.2k views
Original Post
_Danneman_
_Danneman_
Hi! Im curious about how more powerful Java Servlets really is compared to PHP? They are both platformindependent, free to use (as I understand), so thats all good. But what about the trade-off between power vs. ease of development? Could someone initiated please elaborate on that? Btw, my level of knowledge of this stuff (so that the discussion gets targeted at the correct level): know some Java, and some php. Can handle databases ok. Some experience in using servers (not much, though). -------------------------- “Beware the leader who bangs the drums of war in order to whip the citizenry into a patriotic fervor, for patriotism is indeed a double-edged sword. It both emboldens the blood, just as it narrows the mind. And when the drums of war have reached a fever pitch and the blood boils with hate and the mind has closed, the leader will have no need in seizing the rights of the citizenry. Rather, the citizenry, infused with fear and blinded by patriotism, will offer up all of their rights unto the leader and gladly so. How do I know? For this is what I have done. And I am Caesar.” — Julius Caesar
------------------------Why of course the people don’t want war. ... That is understood. But after all it is the leaders of the country who determine the policy, and it is always a simple matter to drag the people along, whether it is a democracy, or a fascist dictatorship, or a parliament, or a communist dictatorship ...Voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is to tell them they are being attacked, and denounce the pac
Dean Harding
Dean Harding
Java servlets generally have been IDE support. Of course, they all pretty much similar (i.e. ASP vs. JSP vs. PHP - mind you ASP.NET is very different to those three, but that''s another story all together )

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

NuffSaid
NuffSaid
Take a look at this and this.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Petr Stedry
Petr Stedry
Hi,

The basic difference is that with PHP you usually only aim at creating HTML - so you embed some PHP code into a HTML page (an alternative to PHP in java are the JAVA server pages - JSP).

The strength of PHP (applies also to JSP) lay in the fast creation times for a simple application.

On the other hand servlets can be the heart of any request-response system (static web pages are a HTTP based request-response system, where the web server just server those static web pages upon request).
You can do almost anything (that''s possible in JAVA) upon reques, for example communicating with other programs/devices over any protocol you want (RMI, CORBA, etc.). Servlets are also much more scallable than PHP.

My pick would be PHP if you''re going to create a simple guestbook, but would recommend servlets if you have to implement a company''s information server.

Also you won''t find many (if any) free application servers (to run you servlets on). In fact I''ve never heard about anything similar.

P.S.: The servlet engine tends to use quite loads of memory, so don''t try to run it under let''s say 512MB of memory or you can run into trouble.

hope that''s enough ...

Petr Stedry
Petr Stedry
WayfarerX
WayfarerX
First off, when we talk about Java on a web server, we''re talking about more than just servlets. You''ve got servlets, filters, JSPs, tag libraries, etc. All these tools and the power of a full OO language can make handling complicated problems a lot easier.

On the other end, PHP is dead simple. Writing a page to display a database query takes only a few minutes and is easy to understand and deploy. I seriously doubt any raw performance difference would be signifigant given the overhead of database connectivity.

I think the big question is going to be how much actual logic is required in your app. Are there places you say things like: "User A sees this data, but User B sees this other data" or "User A can only do this after these conditions are met." Java will let you solve these problems in a much more natural and maintainable way than PHP, but it will add a bit of development overhead to a simple database script.
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
_Danneman_
_Danneman_
Thanks for clearing my mind a bit

Well, I guess PHP will be enough for the time being. Im keeping the Java Servlet Programming Bible I found for 10 bucks though, just in case Ill need it later..
------------------------Why of course the people don’t want war. ... That is understood. But after all it is the leaders of the country who determine the policy, and it is always a simple matter to drag the people along, whether it is a democracy, or a fascist dictatorship, or a parliament, or a communist dictatorship ...Voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is to tell them they are being attacked, and denounce the pac

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.