Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Jsp Versus Php, about differences between JSP and PHP
masrawy
post Mar 7 2008, 11:37 AM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 11
Joined: 6-March 08
Member No.: 58,970



Both of JSP and PHP are technologies used to build dynamic web sites, JSP embeds java syntax with html to create dynamic pages, while PHP is an open-source page scripting/templating system, but in the long run, JSP and Java provide a more powerful system.

Here is a list of reasons why JSP is better than PHP:

QUOTE
- Anything you can do with PHP, you can do with JSP; the reverse is not true

- JSP is much more powerful, since it has access to all the Java libraries. PHP only has access to PHP libraries

- JSP is Object-Oriented, so leads to cleaner code that's easier to debug, maintain, and improve. (PHP also allows objects, but the - object model is more primitive, and most scripted pages ignore PHP objects and just use normal variables.)

- The equivalent syntax in JSP is just as simple to learn, so you can get up and running just as quickly -- that is, there's no extra startup cost in using Java, at least not a significant one

- Java programmers (as opposed to 15-year-old hackers or HTML monkeys) appreciate the importance of a clean language with complex OO data structures and strong typing

- With JSP, if the code inside a page gets too big, or if you want to use it elsewhere, you can cut it out, make it into a Java class, and invoke it from anywhere in your application (even not from a page). With PHP, you're stuck inside the HTML box.

- JSP's concept of state management and persistence is more explicit and powerful than PHP's. With JSP, you can specify whether a variable persists for the page, the request, the session, or the application (or if it's just local to the function). The JSP engine automatically does the right thing with cookies so you have access to the variable on later requests. With PHP, you just have "global" and "not global", you don't have automatic session management, and have to do your state thing manually with cookies or hidden variables.


any comments will be apppreciated.

Notice from rvalkass:

Anything you copy should be put in Quote tags.
Readme ~ Rules ~ AUP
Go to the top of the page
 
+Quote Post
evilguru
post Mar 7 2008, 08:26 PM
Post #2


Newbie [Level 1]
*

Group: Members
Posts: 10
Joined: 17-June 05
Member No.: 8,371



QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- Anything you can do with PHP, you can do with JSP; the reverse is not true

Care to elaborate? Anything I can do in JSP I can also do in C, which I can also do in assembler. I can also do things in C which I can not do in Java (direct memory access, for example). Therefore using that logic all websites should be written in C.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- JSP is much more powerful, since it has access to all the Java libraries. PHP only has access to PHP libraries

C has access to all of the PHP and Java libraries (using the appropriate bridges). C wins again.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- JSP is Object-Oriented, so leads to cleaner code that's easier to debug, maintain, and improve. (PHP also allows objects, but the - object model is more primitive, and most scripted pages ignore PHP objects and just use normal variables.)

PHP5 supports almost exactly the same object model as Java. Abstract classes, interfaces, public, protected and private member variables/functions, pass by reference, static functions/variables.

Your second point (about developers ignoring such features) notwithstanding; the features of a language exploited by its respective community is irrelevant when comparing languages. The fact of the matter is they exit.

By inflection you are also categorically static that object orientated code is always better. I dispute that. If Java was multi paradigm (like PHP or C++) I wonder how many people would forgo the object orientated features in some situations.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- The equivalent syntax in JSP is just as simple to learn, so you can get up and running just as quickly -- that is, there's no extra startup cost in using Java, at least not a significant one

The number of hosts supporting JSP is smaller than that of PHP. The PHP community is significantly larger (for the hobbiest sector anyway). I know both Java (I normally use Swing/SWT, so desktop apps) and can tell you it is a lot harder than PHP.

Try explaining to a beginner how to connect to a MySQL/PostgresSQL database in Java using JDBC and then compare it to the required PDO code.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- Java programmers (as opposed to 15-year-old hackers or HTML monkeys) appreciate the importance of a clean language with complex OO data structures and strong typing

Again, this is not a language thing, but more a social one. Notwithstanding.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- With JSP, if the code inside a page gets too big, or if you want to use it elsewhere, you can cut it out, make it into a Java class, and invoke it from anywhere in your application (even not from a page). With PHP, you're stuck inside the HTML box.

100% not true. On the lowest level PHP supports including of other PHP files. Boom, a simple template system. Further up the food chain there is Smarty (a true templating language) and even further up there is ezcComponents and the Zend Framework, which provide the MVC design pattern to PHP.

QUOTE(masrawy @ Mar 7 2008, 11:37 AM) *
- JSP's concept of state management and persistence is more explicit and powerful than PHP's. With JSP, you can specify whether a variable persists for the page, the request, the session, or the application (or if it's just local to the function). The JSP engine automatically does the right thing with cookies so you have access to the variable on later requests. With PHP, you just have "global" and "not global", you don't have automatic session management, and have to do your state thing manually with cookies or hidden variables.

PHP has sessions http://uk2.php.net/session . They are 100% transparent to both the programmer and user.

Regards, Freddie.

This post has been edited by evilguru: Mar 7 2008, 08:30 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. America Vs. The Rest Of The World(43)
  2. Teamspeak 2 Vs Ventrilo(12)
  3. Frozen Versus Kubi(15)
  4. Inspiron/latitude/precision Quality Differences?(6)
  5. Favourite Versus Game Series(4)
  6. Pentium M Differences: 1.73ghz? 1.86? 2.1?(2)
  7. Php Version Differences? Or Not?(5)
  8. Script Won't Work At Trap17 -- Version Differences?(12)
  9. Amateur Versus Professional Art(19)
  10. Server Differences?(3)
  11. Oracle And Cisco, What Are These,(4)
  12. Windows 2000 Versus Windows Xp(19)
  13. Differences Of Squares(10)
  14. Whether To Use Adobe Live Cs2 Versus Dreamweaver Mx?(2)
  15. Versus In Fantastico(3)
  1. Compare Two Vars And Highlight The Differences(7)
  2. Ie And Firefox Layout Differences(11)
  3. 3d Landscape In Swishmax (flash)(1)
  4. Differences Between Trap17 & Qupis(3)
  5. A Demonstration Of Floats, Clears And Absolute Positions(1)
  6. Naruto Versus Sasuke(3)
  7. Final Fantasy Xiii/versus Xiii(1)
  8. Age Differences Of Friends(8)
  9. Advertised Isp Speed Versus Actual Speed(5)
  10. What Will Be The Side Effects If We Can Move And Think On The Speed Of Light(4)
  11. The Three Level Of Consciousness(4)


 



- Lo-Fi Version Time is now: 7th October 2008 - 08:58 AM