Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: PHP vs. JSP

Reply
Thread Tools

Re: PHP vs. JSP

 
 
Wojtek
Guest
Posts: n/a
 
      08-21-2003
On Wed, 20 Aug 2003 21:32:19 -0400, "John MacIntyre"
<(E-Mail Removed)> wrote:

>Hi,
>
>I am planning to move my web page onto a Linux server and will need to
>rewrite my sites from ASP.
>
>I am at a crossroads on whether I should chose PHP or JSP. Or possibly even
>something else.


>Any input on each technology, or where I could find a non-biased comparison
>would be greatly appreciated. Since, what ever I go with, I will probably
>be sticking with for the next few years.


ASP, PHP, and JSP are all intended to mix code with HTML.

So ASP has HTML and Visual Basic code, JSP has HTML and Java code, and
PHP has HTML and PHP code. All use some form of <% %> to contain the
code.

However, PHP can also be a standalone program with NO HTML, which is
why it can be run from the command line, just like Java and Visual
Basic.

I have coded quite a bit in both PHP and JSP/Java. Both use a C like
syntax.

PHP is always interpreted (you CAN get PHP compilers, but you will
need a special server process to run them). JSP's are compiled, and in
fact become part of the Web application binary code.

PHP is OK for small projects. By small I mean less complex, not fewer
pages. The reason for this is that if you try to create a framework
for your Web application, the amount of time it takes the PHP
interpreter to process the frame work will swamp out the time it take
for a particular page to run. For instance, in one of my trials, it
took over 85% of the loading time of a page just to process the
framework. Remember, PHP code is NOT resident in memory, so EVERY
application service you need must be interpreted for EVERY page hit.

On the other hand, a JSP page is usually run as part of an
application. The application server loads the framework and holds it
in memory. Then as each page request come through, the code for that
page has all the framework resources available to it.

So if you do multi-language sites, PHP must load the langauge specific
text for each page hit (possibly loaded from a database - which
happens for each page hit), while JSP/Java already has it resident in
memory as a resource object (possibly loaded from a database during
application startup - which happens once).

PHP is not object oriented. Yes it has classes, but the implementation
breaks a LOT of OOD concepts. It is more like the OO in Visual Basic.


All that having been said, I prefer PHP for quick Web sites, and
JSP/Java for more complex sites.
------------------------
Wojtek Bok
Solution Developer
 
Reply With Quote
 
 
 
 
John MacIntyre
Guest
Posts: n/a
 
      08-22-2003
"Wojtek" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On the other hand, a JSP page is usually run as part of an
> application. The application server loads the framework and holds it
> in memory. Then as each page request come through, the code for that
> page has all the framework resources available to it.
>
> So if you do multi-language sites, PHP must load the langauge specific
> text for each page hit (possibly loaded from a database - which
> happens for each page hit), while JSP/Java already has it resident in
> memory as a resource object (possibly loaded from a database during
> application startup - which happens once).
>


Thanks Wojtek,

JSP sounds to me like the way to go, but it sounds like JSP more resource
intensive.

Is JSP a resource hog?

Thanks again,
John MacIntyre



 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      08-22-2003
On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <(E-Mail Removed)> wrote or
quoted :

>If you change a JSP file, then the server will automatically compile
>it. So the first user to hit that page will suffer a slight delay, but
>all subsequent users will not. Or you can pre-compile the JSP.


The key point to understand is the JSP page is NOT compiled on every
request!

The other point is that you can change the JSP code on the fly without
taking down the server, or can you?



--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Randall R Schulz
Guest
Posts: n/a
 
      08-22-2003
Roedy,

Roedy Green wrote:

> On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <(E-Mail Removed)> wrote
> or quoted :
>
>
>> If you change a JSP file, then the server will automatically
>> compile it. So the first user to hit that page will suffer a
>> slight delay, but all subsequent users will not. Or you can
>> pre-compile the JSP.

>
>
> The key point to understand is the JSP page is NOT compiled on
> every request!
>
> The other point is that you can change the JSP code on the fly
> without taking down the server, or can you?


You can. At least on the reference implementation, Tomcat. I believe
it's commonly supported, if not mandated by the spec, but I'm too lazy
to look it up right now.

Randall Schulz

> Canadian Mind Products, Roedy Green.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
Learn how to edit php pages with free php editor torque63 HTML 0 01-01-2009 03:45 AM
RE: php and python: how to unpickle using PHP? Ted Zeng Python 0 10-13-2006 12:11 AM
php and python: how to unpickle using PHP? Ted Zeng Python 4 10-03-2006 03:07 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM



Advertisments