aspose file tools*
The moose likes JSP and the fly likes JSP/Servlet VS PHP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP/Servlet VS PHP" Watch "JSP/Servlet VS PHP" New topic
Author

JSP/Servlet VS PHP

Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
So go learn PHP and join the rank of unemployed high school drop outs showing off their PHP skills on their mom's refrigerator.

That's classic....


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Originally posted by William Duncan:
Can someone tell me if PHP can access objects remotely? Can PHP code reside and run on one server and access and use objects located on another? What are it's messageing capablities? Can I write a batch application or a FAT app with PHP? What type of XML support does PHP have? Can I create a web service with PHP that is portable and interoperable, secure, supports open standards (XML, SOAP, WSDL), and supports the SOAP message processing model and extensions?
I ask these questions only because I don't know anything about PHP but have found EJB's extremely beneficial at every place I have been because they can be accessed remotely and therefore maintained in one spot. Also, they represent a clean separation of reusable business logic which is generally code that is already written and therefore, I do not have to.
JMS has also been extremely useful. We have vendors that request information from our database. With JMS we can supply them with the data they need without giving them access to our mainframe. They can request this information without ever knowing what tables they need to hit or even if they are getting data from a legacy system. And message delivery is guaranteed even if the server goes down and messages are not duplicated. We can encrypt this message in order to secure highly sensitive data as well.
Our apps rely on a set of xml configuration files so that when certain aspects of the application change, such as the name or location of a pdf report or a database lookup name, all we have to do is change a config file without ever touching the code running on the server. We have a highly dynamic environment. Our apps change on an almost daily basis according to user needs. The ability to do this is invaluable.
And, as mentioned already several times, security is a sticking point for IT managers and is one reason they shy away from .NET and MicroSoft.
We can do all this without spending big $$$ to cross-train everyone in multiple languages and without worrying what platform our applications will be running on 2 years from now or even longer.
Can PHP do all of that?

I think you hit the nail on the head for me. Thanks for the good response William. Interesting cross-training point too. Never thought of that. Even though that really isn't PHP related.


GenRocket - Experts at Building Test Data
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
Hi Guys,
I just sat and read all the posts above and found the discussion mostly positive with some unnecessary diversions.
After graduating I worked with Cold Fusion extensively for a year and thought it was good because of the ease of use. Then in my spare time I wrote a CMS in PHP and MySQL (still in use 3 years later), there weren't all these open source ones available those days and thought I'd never use another language.
My main problem with both of Cold Fusion and PHP was their short comings in developing large applicationa and then a year and a half ago I started to develop a quoting engine for cars in PHP and soon decided to switch to JSP / Servlets and believe it was the best thing I did. We now use a Model 2 MVC for our webapp and the maintenance is very easy.
I would still use PHP for smaller sites, for example I had a couple of weeks to setup a new site (part-time) and just used pmachine (a PHP web publishing tool) to setup and it did the trick.


The secret to creativity is knowing how to hide your sources.
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Originally posted by Thomas Paul:
Poor herb. You are so lost. Yahoo does not use PHP. They use PHP for some trivial internal work that they used to use some specialized scripting. They do not use it for their search pages. PHP sucks. I have used it. It has no transactional support. No asynchronous messaging capability. No built-in security features. It is pathetic for mission critical applications. Trying to split php into a Model 2, MVC architecture is an excercise in futility.
As far as the list of companies that use it, that is irrelevant. My company, for example, used it for a quick and dirty throw-away web site that we put up to support 2 customers while we developed the real distributed application to support all of our customers. So I assume that you would consider us one of the big wins for PHP. Big Whoop!
But the real proof is the job search. Go to any site and do a search for Java vs. PHP. I just did a search on hotjobs for my area. 6 PHP (one job was actually for a Java programmer to replace their php app). 206 Java jobs.
So go learn PHP and join the rank of unemployed high school drop outs showing off their PHP skills on their mom's refrigerator.
And Herb, no one is impressed when you quote figures like "runs four times faaster" from a site that sells PHP products. And I thought after the blond joke fiasco that you were leaving the ranch? "My work here is done,and like the ancient apostles, I shake the sand from my sandals and leave this city."
[ July 29, 2003: Message edited by: Thomas Paul ]
[ July 30, 2003: Message edited by: Thomas Paul ]

Funny how we resort to personal attacks and completely off-track comments when Java is attacked. :roll: As if job postings showed the relative merits of the two langauges. :roll: I also fail to see the relevance of mentioning blonde joke postings in the Meaningless drivel forum (By the way, my commnets referred to that thread only, which was an insulting thread to women) :roll:
And you're wrong about Yahoo using PHP for trivial work only. They've publicly stated (follow the link trail in URL previously given) that they are using it for new application development and its in now use in the calendar functionality for their users and other NON-internal apps used by their customers.
We can spend all day saying that JSP has this feature, and PHP has that feature that JSP does not. It obviously comes down to the best tool for the job. The majority of web sites are best suited for PHP becuase it was specifically designed for Web development, ease of use, quick development, and readability/maintainability. Enterprise apps are better suited using JSP since PHP doesn't have any type of Beans and other multi-tiered enterprise features. However, this doesn't mean that large sites are still not better developed with PHP because complexity/scalability can still be easily addressed using templates and OO principles (which PHP has although less developed than Java), and most web sites are not Enterprise apps and will never will be.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by herb slocomb:
...most web sites are not Enterprise apps and will never will be.

That is correct. Most web sites are personal/hobbyist web sites. My own personal site, for example, has a php based forum. So what (other than the fact that increases the number of php sites by 1)? No one is hiring PHP programmers.
Originally posted by herb slocomb:
We can spend all day saying that JSP has this feature, and PHP has that feature that JSP does not.

Amusing that once we blow PHP away with features it doesn't support you change your tune, but name one feature that PHP has that Java does not have.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Originally posted by Thomas Paul:

but name one feature that PHP has that Java does not have.

I will never claim guru status on either language, but have used both to build small apps in the past and have always tried to be well read and open minded on both techonologies. Since you ask for a feature that Java (JSP?) does not have that PHP does, well at the lower level, what about variable variables(you'd be surprised how useful this is after you have this feature), and at a higher level what about the ability to be non-object oriented or object-oriented as the situation merits? Being always object oriented can be overkill on some projects and slow development speed; PHP gives you the flexibility to adapt according to the demands of the situation in that regard.
Forgive me for not responding to the non-relevant parts of your prior posting.
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Originally posted by William Duncan:
Can I write a batch application or a FAT app with PHP? .
We can do all this without spending big $$$ to cross-train everyone in multiple languages and without worrying what platform our applications will be running on 2 years from now or even longer.
....
....
Can PHP do all of that?

You can write batch apps with PHP, but I'm not aware that you can do most of the other things. BUT, I'm no expert and there are lots of third party development going on daily making libraries to do many of the things
you did mention. Very similar to the useful CPAN modules/libraries that PERL has.
No need to spend big bucks on cross training anybody on PHP.
If you know Perl, C, Java, or almost any other language used
in web programming, you should be able to pick up PHP on your own
with a good book in a week during the evening hours.
PHP will be here 2 years.
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Originally posted by Gregg Bolinger:


This is a JAVA site. If you hate JAVA so much, why are you still hanging around?

[ July 29, 2003: Message edited by: Gregg Bolinger ]

Ah, wouldn't Life be so much more sweeter if every programming language group segragated themselves from each other so they could all sit around and pat themselves on their collective backs congratulating themselves on the greatness of their particular language without some wisea$$ from another group making snide comments.
I don't actually hate Java. I am Sun certified in Java for the past few years, but have been unable to find a Java programming job of any type.
So the snide comments in earlier posts about unemployment and PHP could just as easily apply to Java (so our Job discussion forum). I am in the middle of doing an e-commerce site on the side now after the hours of my regular programming job.
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303

My main problem with both of Cold Fusion and PHP was their short comings in developing large applicationa and then a year and a half ago I started to develop a quoting engine for cars in PHP and soon decided to switch to JSP / Servlets and believe it was the best thing I did. We now use a Model 2 MVC for our webapp and the maintenance is very easy.

Hi Faisal,
I've always looked at ColdFusion as a rapid-development presentation environment -- somewhat along the line of Struts. As long as you remember to separate Model, View, and Controller and place the logic in appropriate tiers, ColdFusion can be used to speed up development while taking advantage of the paradigm.
For instance, say you're develop a complex application consisting of an HTML-client on Machine A, Windows clients on Machines B1..Bn, business components on Machine C, and a number of external datasources and data services. ColdFusion can be used to develop an MVC-based HTML-client that communicates with business components on the back-end using the <cfobject /> tag, the local and remote data sources made available through the ColdFusion Administrator, XML services, etc. Indeed if you look at ColdFusion MX and the soon to be released ColdFusion RedSky, these technologies are built to be deployed in a Web Container or Application Container like Tomcat or WebSphere. And the ColdFusion pages themselves are compiled to JSP behind the scenes.
ColdFusion, then, best serves as a complement or replacement to JSP or HTML or PHP or << etc >>. It's main claims to fame are ease of use, relatively affordable pricing, speed, Java/.NET/XML Service compatibility, limited cross-platform deployment, and of course speed of development.
Darryl
ah hofelt
Greenhorn

Joined: Jul 31, 2003
Posts: 2
Originally posted by William Duncan:
Can someone tell me if PHP can access objects remotely? Can PHP code reside and run on one server and access and use objects located on another? What are it's messageing capablities? Can I write a batch application or a FAT app with PHP? What type of XML support does PHP have? Can I create a web service with PHP that is portable and interoperable, secure, supports open standards (XML, SOAP, WSDL), and supports the SOAP message processing model and extensions?
>>>>
YES! YES! Can use JMS or write your own. YES! Most XML, supports open standards. It is easier to use a java object in PHP than in JSP.
I ask these questions only because I don't know anything about PHP but have found EJB's extremely beneficial at every place I have been because they can be accessed remotely and therefore maintained in one spot. Also, they represent a clean separation of reusable business logic which is generally code that is already written and therefore, I do not have to.
>>>
Separation of business logic is a big 'buzzword'. Any programmer worth his salt will do this on his own - when necessary. I don't agree this is an important part. EJB's are useful, especially in transaction processing. The tradeoff is resource usage and speed. They are slow and use precious memory.
JMS has also been extremely useful. We have vendors that request information from our database. With JMS we can supply them with the data they need without giving them access to our mainframe. They can request this information without ever knowing what tables they need to hit or even if they are getting data from a legacy system. And message delivery is guaranteed even if the server goes down and messages are not duplicated. We can encrypt this message in order to secure highly sensitive data as well.
>>>
I am not familiar with messaging. Sorry, I should look this up.
Our apps rely on a set of xml configuration files so that when certain aspects of the application change, such as the name or location of a pdf report or a database lookup name, all we have to do is change a config file without ever touching the code running on the server. We have a highly dynamic environment. Our apps change on an almost daily basis according to user needs. The ability to do this is invaluable.
And, as mentioned already several times, security is a sticking point for IT managers and is one reason they shy away from .NET and MicroSoft.
We can do all this without spending big $$$ to cross-train everyone in multiple languages and without worrying what platform our applications will be running on 2 years from now or even longer.
Can PHP do all of that?

>>>
Yes. In fact Java is now embracing the PHP community by writing a standard interface. Check out http://zend.com for more info. The standard will be in place by next year, JSP's will be gone in 5 years - and no one will miss them!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I would rather have a php LIKE java scripting language rather than a JAVA Interface to PHP. You still would be dealing with some portability issues, PHP version issues.
But a php LIKE java scripting language would be kind of kewel. Then you could still use servlets, but lose JSP. Kind of like Velocity.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by ah hofelt:
Yes. In fact Java is now embracing the PHP community by writing a standard interface. Check out http://zend.com for more info. The standard will be in place by next year, JSP's will be gone in 5 years - and no one will miss them!

Check out http://www.jcp.org/en/jsr/detail?id=223 to shee what ah is talking about. All that has happened is that Zend has been added as one of the companies participating in a process to allow scripting languages a more reliable interface into Java. This is by no means a process to replace JSPs. Even ASP will be involved in the process. Does anyone think that JSPs will be replaced by ASP? I wonder if it is now the way of the PHP community to take a page from Microsoft's book and start spreading FUD.
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
PHP, Coldfusion, ASP, PERL and many, many others are out there already and have been out there for a long time but the Java community continues to grow. JSP's may very well be a thing of the past in 5 years, but I think it is a bit presumptuous to say that PHP will be the holy grail that will replace JSPs. Why hasn't it done so already?
Integrating PHP on the front end with a Java backend doesn't mean that PHP can do all the things that I previously mentioned. It just means that it can interact with Java and tell it to do those things. If anything replaces JSPs and Java it will be .NET. Certainly not PHP.
That is not to say that PHP doesn't have it's place and in fact it's popularity does seem to be growing. I just cannot see companies out there, with multiple Java applications proven and running, with frameworks such as JSP and struts being a corporate standard, with proven security and success all of the sudden reevaluate company standards and decide that PHP should now become the new standard. You will be hard pressed to find an IT manager that will stick his balls on the chopping block for PHP. Not now. Not five years from now.
Partha Banerjee
Greenhorn

Joined: Jun 17, 2004
Posts: 1
I am still a die hard PHP programmer. I live, eat, drink and sleep PHP. One good reason is that it was so easy to pick up for me as I was from the C and shell script background. ASP in comparison looked drab not sure how ASP.NET looks like. Yet I am trying to learn JSP/Servlet. Why? You see PHP may be fast, easy, neat and portable and it may have a huge market but the JSP guys are getting the best bucks in the market not us. We get less than what a JSP fellow gets. Money matters. Why remain a PHP programmer when you can earn double as a JSP programmer. Its like betraying your beautiful,efficient and faithfull wife for an ugly but filty rich girl. Unethical but life is life.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Originally posted by Ron Newman:


Can't you use web.xml to do the same thing for JSPs ?


Yes you can. You can remap URLs to be anything you want for just about any technology.

In our current application, ALL URLs are remapped to the same one internally, the user never sees the actual filenames or servlet names that are serving his request.

PHP is a cheap quick hack tool, looks and feels awfully much like a slimmed down, bumber version of JSP 1.0 without support for things like remote objects, Javabeans, etc. etc.

While that was maybe state of the art in 1998/99 when JSP 1.0 was introduced, it's seriously outdated now and not suitable for large scale applications.

No, PHP has nothing over JSP except the blessing of ESR and his OS police.
Speed of development will be faster for the first draft, but then bog down in copy and paste programming leading to massive amounts of unmaintainable code.
Runtimes are not faster, except maybe the very first call where JSP has a call to the compiler which compiles the JSP into machine code.


42
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Originally posted by Thomas Paul:


Check out http://www.jcp.org/en/jsr/detail?id=223 to shee what ah is talking about. All that has happened is that Zend has been added as one of the companies participating in a process to allow scripting languages a more reliable interface into Java. This is by no means a process to replace JSPs. Even ASP will be involved in the process. Does anyone think that JSPs will be replaced by ASP? I wonder if it is now the way of the PHP community to take a page from Microsoft's book and start spreading FUD.


hmm, JSP was always meant to be a tool that could make use of more than one language for scripting purposes. Java is just the first one (and so far AFAIK the only one with broad acceptance).
So what we're seeing here is not PHP killing JSP but JSP assimillating PHP and ASP both
Would be interesting to see Python used as a scripting language in JSPs...

Resistance is futile, you will be assimillated
Ryan Yogan
Greenhorn

Joined: Jun 18, 2004
Posts: 1
You can not compare a small scripting language such as PHP to a whole frame work like JAVA , no to the guy saying JSP will die J2EE is huge in its self providing awesome enterprise solutions, JAVA alone is too big of a backing, J2SE,J2EE,J2ME alone is something bigger then PHP could ever be, php was started by one man for making his site better, when it became popular in version 3 it became a perfect solution for blog sites and hey check out my homepage sign my shoutbox deals. No big company will touch open source such as PHP becuase it has no support, no security, etc.. It doesnt matter if php truly was a better language for web development, ASP.NET and JSP will still eat it alive just becuase of the face of being supported by SUN and Microsoft, ASP.NET and JSP have there own weaknesses and strengths and are both truly great for the computer industry, nothing is better then writing one app with a Swing frontend that runs on Mac, Windows, and Linux!!! How can you hate that?!?!
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
I have done commercial web development in Java and Perl. I have been involved in authoring several books on Java. I have spent a very large amount of my spare time for the last two years programming PHP, it is very, very good.

I have worked in an organsation that ran the second busiest web site in the Uk (just behind bbc.co.uk). That organisation also had very significant Java experience. They used PHP to deliver all public facing web content. PHP can scale.

To suggest that large companies will not use PHP because it is open source makes as much sense as saying large companies will not touch Linux because it is open source.

PHP runs on more platforms than Java
[ March 07, 2005: Message edited by: Marcus Green ]

SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

One of the reasons I steer clear of PHP for commerical apps is its "support" for Unicode. Kinda makes creating a truly internationalizable site with PHP an impossiblility.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
H Wilson
Ranch Hand

Joined: Feb 23, 2005
Posts: 33
Originally posted by Bear Bibeault:
Perl, The Write-Only Language.



[ July 12, 2003: Message edited by: Bear Bibeault ]


Just curious. Doesn't the criticism against Perl and it's obscure syntax have a lot to do with the fact that it's used so much in working with Regular Expressions? Talk about garbled code. I find I avoid using Regular Expressions simply because I never sat down on a weekend with a book and really learned to use them. I just don't want to deal with it. However, the obsessive-compulsive, beer-drinking programmer in me would really like to learn to use Regular Expresssions effectively. (Sources anyone?) Although, now that Java 1.4 has an API for REs, perhaps I'll delve into them with the enthusiasm of a JSP/Servlet fan.

So what's the concensus? Perl harmful?
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724

PHP runs on more platforms than Java


Which one PHP runs and Java don't?


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Originally posted by Paul Sturrock:
One of the reasons I steer clear of PHP for commerical apps is its "support" for Unicode. Kinda makes creating a truly internationalizable site with PHP an impossiblility.


While this is still pretty much true I have learned that Unicode is scheduled for PHP5.1 or PHP5.2. Until then there is a handly little module you can install and use call mbstring that looks pretty good.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP/Servlet VS PHP